Soutiens les tutos gratuits de en cliquant sur la pub ⬆

Cookie bar & load scripts – Plugin wordpress

Par ,
Publié le November 14, 2019

This documentation is in process. A complete documentation will be available on this page soon.

This plugin is developped and maintained by Arthur d’Hausen. It is available under the licence GPL2. This plugin is compatible with any wordpress theme and tries to be as light as possible so your website won’t be slowed down. This plugin uses a small open-source library named JS Cookie.

This plugin comes with 3 main functionalities :

  • Add a bar preventing on the use of cookies on your website
  • Let any user agree with your privacy policy or let them block cookies on your website. At any time, a visitor of your website can change his choice about the use of cookies.
  • Save UTMs (url parameters) in a cookie in order to use them later.

Add and custom your cookie bar

This plugin add a cookie bar on all pages of your website. Just check the first option to activate this functionality.

This cookie bar is customisable :

  • Custom the text of this cookie bar;
  • Change the url of your privacy policy;
  • Custom the color of the button on the cookie bar.

How to block cookies on your website

When you use this plugin, every visitor can allow or block sensitive cookies on your website. The choice of the user is stored in a new cookie. At any moment, a visitor of your website will be able to change his choice about cookies.

But how do we block cookies. This option is fully customisable so you need to set this option with 3 steps :

Detect all cookies used on your website

To check the presence of cookies on your website, you can use a browser plugin. Then, check the origin of these cookies.Here is a small list of good browser plugins :

  • EditThisCookie on Chrome
  • Cookie Editor on Firefox

These browser extentions will help you identify the cookies on your website and it will tell you if this plugin works correctly. If some cookies are used to manage personal datas, you should block them when a visitor want to block cookies.

Provide the name of cookies you want to delete

This cookie enables you to chose which cookies should be deleted when the user block the use of cookies. Two methods are available to delete these cookies. Just fill in these options with the name of each cookie to delete, separated with the symbol |.


Example 1 : I add the exact name of the cookies created by salesforce / Pardot. I fill in the first field (method 1).


Example 2 : I add the name of the cookies created by Google Analytics. But the first method doesn’t seems to delete these cookies. So I put the names of these cookies in the last field (method 2).


Load scripts that generate cookies separately

We are almost done. Now, we will try to separate scripts that generate cookies. Then, they won’t be loaded anymore for any user that blocked cookies. You have different options here :

  • Load sensitive scripts with the field “scripts that will be blocked”.
  • Load other scripts with the field “Other scripts”. These scripts will always be loaded on all pages of your website.

Example: I want to load the google analytics script on all pages. But these scripts generate sensitive cookies. So I want it to be blocked when a user refuse the cookies. Then, I fill in the field “Scripts to block” with :

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src=""></script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-XXXXXXXX-X');
  • A 3d  bonus option let you add the URL of your favicon. We added this option because it is often a missing setting in wordpress. If you don’t need it, just let it blank.

Get the UTMs (url parameters) of your visitors

This analytic setting help you follow your marketing campaigns. It save and sum UTMs parameters in a cookie for every parameters. This cookie only save utm_source, utm_medium and utm_campaign parameters. Its parameters are generic parameters used by Google Analytics. This setting is activated when you allow the cookie bar.

Example: I want to know the efficiency of all my campaigns on social networks. Then, I used specific links with UTMs on twitter. But when a user fill in a contact form on my website, I don’t know if this user come from my posts on twitter. So I decided to create a specific field in my form that use UTM information stored in my cookie. Then, I will be able to identify this visitor came from twitter before filling the form on my website.

To retrieve the informations stored on this cookie, ask your developers to archieve that. You can also refer to this tutorial to get the information stored in a cookie (with JS COOKIE).

This cookie is not blocked by the cookie bar, because it don’t store any sensitive or personal data. Just update your privacy policy to let your visitors know these informations are saved.

Features to come

This plugin is in progress and new functionalities will come soon. If you need more options, you can suggest its in comments or send a message on the support page of the wordpress plugin. To help us, you can let good comments and stars on our wordpress plugin, or make a donation on Paypal.

Settings to come :

  • Translate the cookie bar oin different languages for your multi-language website
  • Retrieve the UTM parameters in a specific field for Contact Form 7.

Do you need specific features to manage cookies on your website ? Just contact the developer of this plugin here!


Notify of
0 Commentaires
Inline Feedbacks
View all comments