PHPackages                             janvince/smallgdpr-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. janvince/smallgdpr-plugin

ActiveOctober-plugin[Utility &amp; Helpers](/categories/utility)

janvince/smallgdpr-plugin
=========================

None

v1.29.0(1mo ago)102269[1 issues](https://github.com/jan-vince/smallgdpr/issues)PHP

Since Nov 9Pushed 2w ago2 watchersCompare

[ Source](https://github.com/jan-vince/smallgdpr)[ Packagist](https://packagist.org/packages/janvince/smallgdpr-plugin)[ RSS](/packages/janvince-smallgdpr-plugin/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (2)Versions (15)Used By (0)

Small GDPR
==========

[](#small-gdpr)

> Cookie consent bar for October CMS with native Google Consent Mode v2.

Version 2 is a major rewrite: the plugin now owns the Consent Mode plumbing. You map cookie groups to Google consent types and the plugin emits the `gtag('consent', 'update', …)` signal **and** a `dataLayer` event on every page load and consent change — no pasted gtag/GTM snippets needed for the common case.

> **Upgrading from 1.x?** v2.0 is a conscious major upgrade (bump the version in `composer.json`). A migration moves your data to the new schema automatically (it guesses `consent_types` from group slugs and copies your button labels). The Bootstrap dependency and the old style presets are gone — there is now a single floating-pill bar and a native `` settings window, themable via CSS custom properties.

Installation
------------

[](#installation)

**GitHub** — clone into the `/plugins` dir:

```
git clone https://github.com/jan-vince/smallgdpr plugins/janvince/smallgdpr
```

**October backend** — search for *Small GDPR* in:

> Settings → Updates &amp; Plugins → Install plugins

Quick start
-----------

[](#quick-start)

1. **Settings → Small GDPR → Settings → Import** → *Import default settings*.
2. **Settings → Small GDPR → Cookies → Integration**:
    - `Tag type` = *Google Analytics 4* or *Google Tag Manager*
    - `Tag ID` = `G-XXXXXXX` (GA4) or `GTM-XXXXXXX` (GTM)
3. Add the two components to your layout — **both are required**:

```

    ...
    {# REQUIRED — must be inside , as high as possible,
       before any analytics / tag scripts #}
    {% component 'cookiesConfig' %}

    {# right after  opens #}
    {% component 'cookiesBar' %}
    ...

```

> ⚠️ **`cookiesConfig` must live in ``.** It sets the Consent Mode `default` and loads the GA4/GTM tag, and that has to happen *before* any tag fires. Put it as high in `` as possible (ideally first). Without it the bar still renders, but no tags are loaded and consent is never applied.

4. (Optional) create a `/gdpr` page and drop in the **Manage cookies** component (or its page snippet) so visitors can change their choice later.

That's it — no need to paste GA4/GTM code anywhere. The plugin renders the loader, the consent default, the consent update and the dataLayer event for you.

How it works
------------

[](#how-it-works)

- **`cookiesConfig`** (head) outputs, in order: the `dataLayer`/`gtag` stub, the Consent Mode `default` (seeded from saved cookies so returning visitors start `granted`), the GA4/GTM loader (from `Tag ID`), your custom head code, and the plugin JS.
- **`cookiesBar`** (body) renders the GTM `` (GTM only), your custom body code, the floating-pill bar and the settings ``.
- On every consent change **and** every page load (once a decision exists), the JS calls `gtag('consent', 'update', …)` and pushes a `dataLayer` event so non-Google tags can fire via a Custom Event trigger:

```
dataLayer.push({
  event: 'cookie_consent_update',
  analytics_storage: 'granted',
  ad_storage: 'denied',
  ad_user_data: 'denied',
  ad_personalization: 'denied'
});
```

Settings
--------

[](#settings)

### Tab: Cookies

[](#tab-cookies)

**Integration**

- `Tag type` — `none` / `Google Analytics 4 (gtag.js)` / `Google Tag Manager`.
- `Tag ID` — `G-…` or `GTM-…`. The plugin renders the matching loader.
- `Load tags only in production` — when on, the loader is rendered only in the production environment (the bar still works everywhere so you can test the UI).
- `Consent dataLayer event name` — default `cookie_consent_update`.

**Cookies groups** — one group per cookie category (Necessary, Statistical, Marketing, …):

- `Required` — cannot be disabled by the user.
- `Default enabled` — active without explicit consent (use for anonymous data only, mind your local laws).
- `Default checked` — pre-checked in the settings dialog (scripts still gated).
- `Google consent types` — which Consent Mode signals this group grants (`analytics_storage`, `ad_storage`, `ad_user_data`, `ad_personalization`, `functionality_storage`, `personalization_storage`, `security_storage`). This mapping drives the automatic consent update.
- `Scripts` *(advanced)* — optional raw JS/files injected server-side when the group is consented, with `head`/`body` position, production and per-page limits. Most setups won't need this — use GTM + the dataLayer event instead.

**Custom code** — raw `` / `` code injected after the plugin block, for tags the plugin does not load directly (Meta, LinkedIn, Hotjar, …).

### Tab: Cookies bar

[](#tab-cookies-bar)

Title, content, page-reload toggle, and the button labels / visibility (Accept, Reject, Settings, Save).

### Tab: Manage cookies

[](#tab-manage-cookies)

Title and content shown above the cookie list in the **Manage cookies**component / dialog.

### Tab: Settings

[](#tab-settings)

- `Cookies expiration` — cookie lifetime in days.
- `Set cookies for each language` — adds a locale prefix to cookie names (for RainLab.Translate setups that need a separate consent per language).
- **Import** — import a YAML preset from Media, a custom path, or the bundled default (leave empty).
- **Export** — export current settings as a YAML preset (backup / template).

Components
----------

[](#components)

### `cookiesConfig`

[](#cookiesconfig)

Place inside ``, as high as possible. Renders the Consent Mode init and the tag loader.

### `cookiesBar`

[](#cookiesbar)

Place right after ``. Renders the bar and the settings dialog.

**Hide the bar** on a specific page/layout via the [View Bag](https://docs.octobercms.com/4.x/cms/components.html):

```
[viewBag]
hideCookiesBar = 1
```

### `cookiesManage`

[](#cookiesmanage)

Put on a privacy page (e.g. `/gdpr`) so visitors can change their choice. Also available as a Static Pages snippet.

JavaScript API
--------------

[](#javascript-api)

A global `SmallGDPR` object is available:

```
SmallGDPR.get()         // { necessary: true, statistical: false, … }
SmallGDPR.set(state)    // persist a state object + emit signals
SmallGDPR.acceptAll()
SmallGDPR.rejectAll()
SmallGDPR.hasDecision() // has the user decided yet?
SmallGDPR.openSettings()
```

Listen for changes:

```
document.addEventListener('smallgdpr:consent', function (e) {
  console.log(e.detail.state, e.detail.consent);
});
```

Twig
----

[](#twig)

With the `cookiesBar` or `cookiesManage` component on the page you can read the consent state in Twig:

```
{% if sgCookies.statistical %}
  ...
{% endif %}
```

Theming
-------

[](#theming)

The bar and dialog are styled with CSS custom properties — override them in your own stylesheet (no Bootstrap required):

```
:root {
  --sg-bg: #1a2842;
  --sg-primary: #0d6efd;
  --sg-text: #ffffff;
  /* … see assets/css/smallgdpr.css for the full list */
}
```

---

> Thanks to the [October CMS](https://octobercms.com) team and to [OFFLINE](https://github.com/OFFLINE-GmbH) for inspiration from [their GDPR plugin](https://github.com/OFFLINE-GmbH/oc-gdpr-plugin).

Created by [Jan Vince](http://www.vince.cz), freelance web designer from the Czech Republic.

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance92

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~98 days

Recently: every ~108 days

Total

14

Last Release

48d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d0762b85a7c8514e93d4114ae9bbd9dbacfe9efc2b6bd76ef151ebdcec39bf9?d=identicon)[jan-vince](/maintainers/jan-vince)

---

Top Contributors

[![jan-vince](https://avatars.githubusercontent.com/u/1104383?v=4)](https://github.com/jan-vince "jan-vince (116 commits)")[![evwerkz](https://avatars.githubusercontent.com/u/49227960?v=4)](https://github.com/evwerkz "evwerkz (6 commits)")[![ShrikeFIN](https://avatars.githubusercontent.com/u/1734521?v=4)](https://github.com/ShrikeFIN "ShrikeFIN (5 commits)")[![SamBrishes](https://avatars.githubusercontent.com/u/106578633?v=4)](https://github.com/SamBrishes "SamBrishes (3 commits)")[![mediaclinic](https://avatars.githubusercontent.com/u/1957049?v=4)](https://github.com/mediaclinic "mediaclinic (2 commits)")[![anik1ng](https://avatars.githubusercontent.com/u/505388?v=4)](https://github.com/anik1ng "anik1ng (1 commits)")[![ZhiweiWu0425](https://avatars.githubusercontent.com/u/89636889?v=4)](https://github.com/ZhiweiWu0425 "ZhiweiWu0425 (1 commits)")

### Embed Badge

![Health badge](/badges/janvince-smallgdpr-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/janvince-smallgdpr-plugin/health.svg)](https://phpackages.com/packages/janvince-smallgdpr-plugin)
```

###  Alternatives

[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.5k10](/packages/helsingborg-stad-municipio)[mediawiki/maps

Adds various mapping features to MediaWiki

84152.3k3](/packages/mediawiki-maps)[starcitizentools/citizen-skin

A beautiful, usable, responsive MediaWiki skin with in-depth extension support. Originally developed for the Star Citizen Wiki.

3376.6k](/packages/starcitizentools-citizen-skin)[civicrm/civicrm-drupal-8

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

19251.4k3](/packages/civicrm-civicrm-drupal-8)[altis/core

Core module for Altis

19228.0k3](/packages/altis-core)[pfefferle/wordpress-activitypub

The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.

5721.7k4](/packages/pfefferle-wordpress-activitypub)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
