Free Cookie Consent Solution

Free solution for GDPR + EU Cookies Directive (ePrivacy) cookies management

Build your Cookie Consent code

Your JavaScript scripts will be loaded automatically.

Your JavaScript scripts will be loaded only after the user clicks "I agree".

Users should be able to change their cookies preferences. Include a link/button anywhere on your page so that users can open the Cookies Preferences Center:

IDs, classes, tag names can be used as a DOM selector: #changePreferences

If you have a Cookies Policy, include a link to it.

Copy your Cookie Consent code below and begin to adjust your JavaScript scripts.

Copied!

Adjust your JavaScript scripts

The Cookie Consent by TermsFeed solution can be used to notify your users about your website use of cookies. The Cookie Consent solution allows your website users to communicate their privacy preferences to you.

However, it is still up to you to make sure that your website respects the choices made by your website users.

If a website user chooses not to load Advertising Cookies, you need to respect that decision.

Example

Let's take Google Analytics as an example. As a tracking tool, Google Analytics uses cookies, and is therefore subject to the EU Cookie Directive. Google Analytics requires you to add a piece of JavaScript code to your website. With the Cookie Consent by TermsFeed you can enable or disable the Google Analytics tracking code based on what a user's specific privacy preferences is.

To do that:

  1. Organize your different JavaScript scripts into separate <script> elements. Example: your JavaScript that manages users login and users forgot password functionality should be separated from the Google Analytics <script>.
  2. For any <script> element you want to toggle through the Cookie Consent by TermsFeed solution, change type="text/javascript" to type="text/plain".
  3. Then, add a cookie-consent attribute to each element, and set the value of that attribute accordingly to the Cookie Consent levels (see below).

In the following example, there is a linked script that handles essential site functions (user sessions) and the Google Analytics tracking script. The first one will be enabled at the lowest privacy level ("Strictly Necessary"), but the second will only be activated if the user has toggled on to the "Tracking & Performance" preference.

<!-- Shopping Cart Cookies -->
<script type="text/plain" cookie-consent="strictly-necessary" src="/js/shopping-cart-sessions.js"></script>


<!-- Google Tracking Code -->
<script type="text/plain" cookie-consent="tracking"> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', /* Google Property ID */, 'auto'); ga('send', 'pageview');
</script>

Cookie Consent Levels

Cookie Consent by TermsFeed has the following levels available:

  1. Strictly Necessary.
    Cookies related to user account login or other strictly necessary cookies that your website cannot run without.
    <script type="text/plain" cookie-consent="strictly-necessary"></script>
  2. Functionality.
    Cookies related to user account login or other strictly necessary cookies that your website cannot run without.
    <script type="text/plain" cookie-consent="functionality"></script>
  3. Tracking and Performance.
    Cookies that are used by tracking or performance tools, such as Google Analytics or live chat.
    <script type="text/plain" cookie-consent="tracking"></script>
  4. Targeting and Advertising.
    Cookies that are used by advertising services, such as Google Ads or any remarketing service.
    <script type="text/plain" cookie-consent="targeting"></script>
Live Preview