v2.1.x Cookie Notice with Opt-In/Opt-Out (MndCookieNotice)

DateChanges made
19.11.2019

Update documentation for 2.1.0

new in 2.1.0:

  • Layout optimization: the buttons for  "Privacy settings" and "Accept only technically necessare" are now displayed as text links
  • New default texts
  • New plugin configuration for page reload
  • Added missing translations
  • Bug fixes




Note: this software is provided "as is" without any legal gurantee. We are not liable for any legal conformity. Please consult legal support to confirm correct usage for your application scenario.


Description

Cookie Notice

This Shopware Plugin can provide a notice to shop visitors about the usage of cookies (e.g. EU GDPR or privacy compliance, etc.). It provides also privacy-settings for visitors, so they can manually opt-in or opt-out of trackings on your website. Google Analytics is pre configured and our plugin "Facebook Pixel for Shopware" integrates automatically (from version 1.1.3).
Texts, colors and positioning of the cookie notice can easily configured in the plugin settings.

Privatsphäre Einstellungen

From version 1.2.0 you can enable the privacy-settings dialog. It enables visitors to anonymously configure their opt-in / opt-out preferences. From version 1.4.0 you can integrate your own trackings in the privacy-settings.
Via the plugin configuration you can define the default behavior of the trackings. Opt-In tracking is disabled for new visitors per default. Opt-Out: tracking is enabled for new visitors per default.


The Google Analytics opt-out feature should be work with any Google Analytics integration. Please test the function for your implementation, though. Please note, that the intecration code for Google Analytics will load regardless. If you need to integration code only to load when a user opts-in for GA you will need to configure it as a custom tracking.

Currently, pirvacy settings of Facebook Pixel works only with our Shopware Plugin "Facebook Pixel for Shopware" (available at Shopware Plugin-Store). The feature is enabled if you configure the Facebook Pixel plugin accordingly.

Opt-Out links for privacy policy

The privacy-settings of the plugin can be opened anywhere from the shop via javascript code.

The plugin now provides javascript functions to trigger the opt outs in html links anywhere in your shop. E.g. you can add a link in your privacy policy to directly opt-out from google analytics.

Our Plugin "Facebook Pixel for Shopware" provides it's own javascript function to call for opt-in / opt-out from Facebook Pixel Tracking


Screenshots

The Cookie Notice

Banner Mode (top or bottom of viewport)


Overlay Mode:



accept only functional necessary: A click on this button results in no changes to the preset opt-in/opt-out settings of the trackings. Please make sure that only trackings with this classification are enabled by default (opt-out mode)! Default cookies of Shopware will always be active.

accept all: This wil set the opt-in for all configured trackings.



  • Screenshots of privacy settings in shop frontend:

example 1: Trackings activated by default, the can deactivate the tracking with a button click.



example 2: user has deactivated the Trackings for his browser.





Learn more about this feature in the Chapter for privacy settings.

Installation

Installation in the shop

Just install with the plugin manager and customize the configuration options for your needs.

Make sure you clear the Shopware Cache (Frontend and HTTP-Proxy) after the installation.


More information about the plugin installation process in Shopware:

Plugin-Installation: http://en.community.shopware.com/_detail_1638.html?_ga=1.130307917.395169831.1467200155
Plugin-Manager: http://en.community.shopware.com/_detail_1858.html?_ga=1.130307917.395169831.1467200155

Plugin-Configuration


To enable the Google Analytics Opt-In/Opt-Out features, you need to add your Analytics Property ID (UA-XXXXXX-XX) in the plugin configuration. You can add multiple IDs by separating them with comma.


Config Option "Notice-Version"

By increasing the config option "notice version" you can force the disply of the notice to your visitors. The accepted version is part of the accept-cookie of the visitor. If the display has a higher version than the user, the notice is displayed to the visitor.

Privacy Settings

When activating the setting "Link to privacy statement", the link to open the privacy settings will be appended to the cookie notice text for visitors. The link to the privacy settings is also appended to the customers account menu.


Custom privacy cookies

If you want to integrate other tracking cookies to the privacy settings you can easily add up to 5 custom privacy cookies. 

There are three configuration steps:

  1. Choose a cookie label and cookie name
  2. Choose the default setting
  3. Change your integration code

Configure individual trackings

You can configure individual trackings to show in the privacy-settings and control their integration via the set privacy cookie for opt-in and opt-out. You can define 5 individual trackings.

Our plugin sets a "privacy cookie" for each configured tracking with the configured name. In your tracking integratino you can check for the cookie and activate or deactivate the tracking accordingly.

The following steps need to be taken care of:

  1. Set the cookie label: this one shows up in the privacy-settings for the visitor
  2. Set the name of the cookie: This is the internal name of the cookie.
  3. Set the default mode: Opt-In or Opt-Out
  4. Add the if-construct to your tracking integration


  • Backend configuration at the example of "Matomo"

  • Frontend:

 



Customize your Tracking Code Integration

In this case a cookie with the name "matomo-is-active" and the value "true" is created. Now you'll need to integrate the cookie with your integration code:

 <script>
 	if(mndGetTrackingCookie('matomo-is-active') == 'true') {
		your integration code
	} 
 </script>

If the user clicks on the "Opt-Out" button the value of the cookie "matomo-is-active" is changed to "false" and the tracking is disabled.


Opt-Out links for shop content (for use in privacy policy etc.)

You can open the privacy settings for the user anyhwere in the shop with the following html link:

<a href="javascript:mndCookieNotice.mndOpenPrivacySettings();">Privatsphäre-Einstellungen</a>

Links for direct Google Analytics Opt-In/opt-Out:

<a href="javascript:mndCookieNotice.mndGAOptOut();" onclick="alert('Google Analytics deaktiviert.');">Google Analytics deaktivieren</a>

<a href="javascript:mndCookieNotice.mndGAOptIn();" onclick="alert('Google Analytics aktiviert.');">Google Analytics aktivieren</a>


Links for direct opt-in/opt-out from custom trackings:

<a href="javascript:mndCookieNotice.mndOptOutCustom('cookie-name');“ onclick=„alert('cookie-label deactivated.');“>Deactivate cookie-label</a>

<a href="javascript:mndCookieNotice.mndOptInCustom('cookie-name');“ onclick=„alert('cookie-label activated.');“>Activate cookie-label</a>

Just change cookie-name and cookie-label to the values you've configured in the plugin configuration.


Links for direct opt-in/opt-out from all trackings:

<a href="javascript:mndCookieNotice.mndOptOutAll();“ onclick=„alert('All cookies deactivated.');“>Deactivate all cookies</a>

<a href="javascript:mndCookieNotice.mndOptInAll();“ onclick=„alert('All cookies activated.');“>Activate all cookies</a>


Execute additional Javascript-Code

You can enter custom javascript-code in the plugin settings an enabl. This code is run when the user clicks on the 'accept' button (or whatever you label it). Make sure you test your code before you enable this feature.


We recommend placing only dedicated function calls in this field. Complex javascript code is best provided via an javascript include in the template and called via this field. This makes debugging far more easier.

e.g.


functionCall1();
functionCall2();
functionCall3();


Reload the page after user acceptance

You need to change the following configuration to "yes" if you want the page to be reloaded after user acceptance/action.

Please note that this can cause errors regarding POST requests.


Text configuration

In order to change the text of notice and button please navigate to the snippet management at Configuration → Snippets.
Search for "MndCookie" and you'll find the relevant snippets:

Select the snippet you want to change and click on the button "Edit selected snippets" from the menu above. You can also use HTML for advanced formatting.


Please note that you'll probably need to clear the Shopware cache again and eventualy the template have to be new compilated, in order to see the changes in the frontend.


Placed Cookies

Cookie nameZweckKommentar
​mnd-ga-opted-inGoogle Analytics Opt-In​valid for 100 years
ga-disable-UA-XXXXXXX-XXGoogle Analytics Opt-Outvalid for 100 years
Will be stored for each Google Analtyics Property ID configured.
<individual name>Opt-In / Opt-Out for individual trackings

valid for 100 years
Will be stored for each cofigured individual tracking

mnd-cookie-accepted- + (shop url without special characters or spaces, e.g. wwwgooglecom) + cookie version (plugin config option)Hides the notice if the visitor already saved the preferred behaviour.validity can be configured in the plugin config, default 31 days


You can find more information about our plugin "Facebook Pixel for Shopware" on its documentation page here: v1.x.x Facebook Pixel (MndFacebookPixel) -EN

Integration into the privacy settings is provided from version 1.1.3


Deinstallation

Uninstall via the plugin manager.

Set cookies won't be removed from the users browser.