Coder Social home page Coder Social logo

smallgdpr's Introduction

Small GDPR

Simple plugin to cope with GDPR

Installation

GitHub clone into /plugins dir:

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

OctoberCMS backend

Just look for 'Small GDPR' in search field in:

Settings > Updates & Plugins > Install plugins

Permissions

Settings > Administrators

You can set permissions to restrict access to Settings > Small plugins > Small GDPR and to messages list.

Quick start guide

Cookies

  • Install plugin.

  • Go October's settings page and click on GDPR > Cookies.

    • Go to tab Import and click button Import default settings.
    • Go to tab Cookies, add your JS code to cookies group as you need.
  • Go to CMS part of October.

    • Add new Layout (or use your existing)
    • Add component Small GDPR > Cookies bar (inside of your body tag).
  • Go to CMS part of October.

    • Add new Page with URL /gdpr
    • Add component Small GDPR > Manage cookies (inside any of your tags)

Do not forget to add {% scripts %} tag to your layout page just before closing body tag! More info in October docs.

  • Open your website - cookies bar should be visible :)

Settings

Tab: Cookies groups

The main idea is to create groups of cookies with JS scripts that you want to run on your website.

Required

When turned on users cannot disable these groups in Manage cookies component and scripts will be always executed.

Default enabled

Scripts in these groups will run without explicit user concent but can be disabled by user (in Manage cookies component).

Be careful not to violate your local laws!

Default checked

Scripts in these groups will not run but in modal window they will be pre-checked.

Scripts

You can add one or more scripts to selected group

Custom JS code or files

You can add your own JS code and/or files to be executed when a cookies group is allowed (or required).

You can optionally limit scripts execution to production mode.

Run only in production

Script wil be executed only in production environment.

Disable

This scripts will never be executed

Run on specific pages

You can limit scripts execution to specific pages URLs.

Tab: Cookies bar

You can edit title and content of cookies bar.

If you want, you can select from pre-defined CSS styles.

Buttons

You can add one or more buttons to your cookies bar.

Allow all cookies

When turned on, click on this button will set all cookies groups enabled.

Usefull for "Allow all" button on Cookies bar.

Note: Users can change cookies settings later on CMS page with Manage cookies component (like /gdpr) if you create one.

Open modal window

When turned on, click on this button open modal window with list of cookies group.

Currently supported only for Boostrap 3 UI style (can be set on tab Settings).

Tab: Manage cookies

Just add title and content and those will be shown above cookies groups listing in Manage cookies component.

Tab: Settings

Few general settings to be set.

Cookies expiration

Number of days for cookies to live in browser.

UI style

Change formating of output HTML code.

Set cookies for each language

Default is on.

This is required if you use Rainlab Translate plugin and you set up cookies groups for each language with different cookies groups codes.

On the other hand if you have separate languages but same cookies groups codes and you want your visitors not to have consent for each language separately, you can switch this off.

Tab: Import

You can import settings presets from Media your own path or default plugin preset (if you leave all empty).

You have to use YAML format.

Note: Try Export first to get idea of an import file structure.

Tab: Export

You can export current settings data to configuration file and use it as a backup or template for other sites.

Components

Cookies bar

Should be used in your Layouts or Pages.

Hide Cookies bar

If you need to hide Cookies bar on specific Page or Layout, you can use View Bag on your Page this way:

[viewBag]
hideCookiesBar = 1

Manage cookies

Put this component to your page with details about privacy (like /gdpr or /cookies).

Manage cookies component can be also added as a snippet to Static Page

Users will be able to change cookies settings.

HOWTO

With component Cookies bar or Manage cookies you can access cookies settings in your Twig code like this:

{% if sgCookies.necessary %}
 ...
{% endif %}

My thanks goes to:
OctoberCMS team members and supporters for this great system.
Brooke Cagle for her photo.
Font Awesome for nice icons. OFFLINE for inspiration from his GDPR plugin

Created by Jan Vince, freelance web designer from Czech Republic.

smallgdpr's People

Contributors

jan-vince avatar evwerkz avatar shrikefin avatar sambrishes avatar mediaclinic avatar anik1ng avatar zhiweiwu0425 avatar

Stargazers

Pavel Lautsevich avatar  avatar Paolo avatar Michael Pritchard avatar Dheia avatar Sherhey Bezuhlyi avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

smallgdpr's Issues

Managing cookies, choices not saved or updated?

I'm having an issue over several different installations where the manage cookies form, and the modal for that matter, does not update the checkbox choices properly.

Enter the modal or page with manage cookie component and changing what cookies to allow, then when saving, if one of the optional cookie checkboxes are unchecked, it reverts back to checked when saved.

I have an example of it (albeit in Norwegian, but I think you can get the drift anyway) at this link. It's not possible to deselect the optional cookie on this page and save it, it always reverts back.

What am I doing wrong?

"Illegal string offset 'show_modal'"

Hi and thank you for the plugin!
I have an issue, trying to translate cookie bar buttons, by creating the buttons for each language, the plugin shows an error and doesn't allow to switch between languages.
""Illegal string offset 'show_modal'" on line 546 of /home/site/public_html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php"

W3c error: Duplicate attribute checked

Hi,

I am not sure if it is possible but is there a workaround to fix the w3c error?
"Duplicate attribute checked"

<div class="form-check">↩
     <input class="form-check-input " type="checkbox"↩
          id="sg-cookies-statistical-modal"↩
            checked checked >↩
       <label class="form-check-label" for="sg-cookies-statistical-modal">↩
                Statistical cookies↩
      </label>↩
</div>↩

Problem with adding GA code

Im tryin to use Small GDPR plugin October 3.5.12, it seems to work but it doesn't add the GA code when i agree to cookies also when i try to save custom settnings Error: Incorrect contents fetched, please reload.

Google Tag Manager compatibility?

Hello!
I'm having an additional question regarding cookie consent management.
On the website, I use Google Tag Manager, the code script must be placed at the beginning of the <head> and <body> sections.
In the plugin settings section, there is Custom JS code window, and GTM code placed there won't be rendered at the beginning of the <head> and <body> sections accordingly.
So, is there a solution to make it work in the right way? Or could it be as a feature request?

For a more convenient way, I use this plugin
Or maybe there is a solution to execute this plugin with a given user consent with your plugin?

Thank you!

Issue with undefined variable $context

Not sure if this is only related to my installation and something I did, but I get this error when adding the plugin to the latest version of October:

An exception has been thrown during the rendering of a template ("Undefined variable $context").
~/plugins/janvince/smallgdpr/components/cookiesbar/cookiesbar.htm line 78
73  <script>
74
75        document.querySelector('#cookies-bar .btn-accept-all').addEventListener('click', function(e) {
76
77            e.preventDefault();
78            {% partial '@set-cookies' %}
79
80            if (document.querySelector('#cookies-bar')) {
81
82                document.querySelector('#cookies-bar').style.display = 'none';
83            }
84            {% for button in cookiesSettingsGet('cookies_bar_buttons', null)  %}

I can't see an apparent error in either the component default partial or the set-cookies that is referenced as the error source on line 789,

I've gone over and removed all my own overwriting partials and started clean a couple of times, but still no dice. The weird thing is I can't find $context in the plugin code, leading me to believe this is either a compatibility thing with the error originating somewhere else, or just my own ineptness at coding ;) Any help would be appreciated.

Unexpected token "name" of value "if" ("end of statement block" expected).

Hello!
I have following error on the smallgdpr plugin

Unexpected token "name" of value "if" ("end of statement block" expected).
~/plugins/janvince/smallgdpr/components/partials/run-scripts.htm line 5
{% if cookiesSettingsGet('cookies',null)|length %}

{% for cookie in cookiesSettingsGet('cookies') %}

    {% for script in cookie.scripts if script.scripts_disable == 0 %}

        {#  If pages list is set, compare to current page URL #}

        {% if script.scripts_run_pages == true and script.scripts_run_pages_list|length %}

            {% set scriptRunThisPage = false %}

            {% for item in script.scripts_run_pages_list %}

`

Localization not working as expected

Hi @jan-vince
first of all - Thank you for this awesome plugin!

I am currently facing a bug with localization:
My backend user's language setting is set to german. The layouts default language is 'de', too. The problem is, that the buttons for saving the cookie settings still have the english strings:
Cookie_Bug

There is no setting in the backend to change this button texts and as I see in the code, the button text should be translated - but this is not working properly.

Do you know what the problem is here?

Thanks in advance!

Issues with OctoberCMS v3.0.37

Got error:

php artisan project:sync In Yaml.php line 43:

A syntax error was detected in /.../octobercms3/plugins/janvince/smallgdpr/updates/version.yaml. The string "!!! Cookies JS code placed in code window now requires <script> tags to be present! Please check your code." could not be parsed as it uses an unsupported built-in tag at line 64 (near "1.4.5: !!! Cookies JS code placed in code window now requires <script> tags to be present! Please check your code.") at line 43 (near "/.../octobercms3/vendor/october/rain/src/Parse/Yaml.php").

CMS_STRICT_VARIABLES=true error

Hi.
OCMS2. Just installed, with CMS_STRICT_VARIABLES=true, and the pages are broken. I need to set this to false to get it working.
Any chance of a fix for this?
Thanks.

iframe

Hi, I have the following problem.

I have a project where the page is displayed via iframe.
The cookie banner cannot be confirmed by clicking OK. After page reload, the banner is displayed again and the JS scripts to be followed, e.g. matomo, are not loaded.

Do you have any idea how to solve it?

Unable to export settings

I got this error:
[Error] Error: Error parsing the data-request-data attribute value. Error: Broken JSON body near ath: /storage/app/media/small-gdpr-export.yaml}
f (framework-bundle.min.js:1:6093)
r (framework-bundle.min.js:1:10053)

with October 3.5.7

Is it possbile to make a manual update of plugin?

Hi!
Thank you for the great plugin!
I've been using the outdated version 1.8.1 installed on October CMS. Now it's not possible to update it through the admin panel.
I've downloaded the latest version from GIT and copied all the files to my website.
In the backend it's still the 1.8.1 version.
Is it possible to run a SQL script in DB or make something to update it?
My website runs on shared hosting, so there is no possibility to run any commands.

Thanks!

Argument $name must be of type string

Hi,
I tried to implement your plugin, but it gives me an error. Is it possible to solve it? Thanks.

Cms\Classes\ComponentBase::addCss(): Argument #1 ($name) must be of type string, array given, called in /home/zap/public_html80/october/plugins/janvince/smallgdpr/components/CookiesBar.php on line 50

Redirect to the main page

After clicking on the agreement button, a redirect to the main page takes place, is it possible to add a setting so that the user remains where he is?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.