Every Foleon publication has cookies, and according to the GDPR regulation, you need to inform your readers about these cookies.

A way to inform your readers would be with our built-in cookie consent pop-up.

However, you might already use Consent Management Platform (CMP) to inform your readers about the cookies that you’re placing.

In this article, we will instruct you on how you can make sure that Foleon cookies listen to your CMP.

In this article

  • General Data Protection Regulation (GDPR)
  • Implementing a third-party cookie banner.
  • How Consent Management Platform (CMP)s and Foleon work together.

General Data Protection Regulation (GDPR)

On May 25, 2018, the General Data Protection Regulation (GDPR) came into effect. The GDPR is a set of laws aimed at enhancing the protection of EU citizens’ personal data and increasing the obligations of organisations to deal with that data in transparent and secure ways. More information about the GDPR can be found here.

A CMP must not only ask a reader to consent to certain cookies. It must also activate the scripts that place those cookies, once given consent for it.

Therefore we recommend that you install a CMP with a script manager such as Google Tag Manager (GTM).

Cookie banner platforms often integrate neatly with GTM and they often provide detailed instructions on how to implement it.

The advantage of using a script manager such as GTM is that you can easily control which script to fire and when to fire it.

If you don’t have a CMP, you can use our built-in cookie consent pop-up.

The role of a CMP is to ask for consent, give a signal once cookie preferences are given, and store the cookie preferences in the browser as a cookie.

Websites or publications need to look for those preferences, listen for that signal that the cookie preferences have been set, and then act accordingly by executing the scripts that are allowed to be executed.

When using a CMP within Foleon publications, we need to the following three things:

  1. Prevent Foleon to place cookies before consent is given.
  2. Prevent your remarketing code to fire before consent is given.
  3. Fire scripts once consent is given for it.

1. Preventing Foleon to place cookies

There are certain cookies that are placed by Foleon once the publication is loaded. For example, cookies related to:

  • Foleon Analytics
  • Google Analytics
  • Custom scripts you’ve placed in the remarketing field.

If you don’t use the Foleon cookie banner, these scripts will be executed when a reader opens a publication and they will set cookies.

To stop that from happening, you can use the following code in either the remarketing code field or in GTM.


if (!window.localStorage.getItem('cc_settings')) {


JSON.stringify({"statistics":0, "marketing": 0, "preferences": 1}));



This code checks if the user already had given consent before. If not, it sets the default cookie preferences so that the Foleon cookies will not be placed.

The default settings are set to block statistics and marketing cookies while enabling preference cookies. You can opt for a different default setup by changing the 0 to 1 in the script.

Here is an example of the code in the remarketing field and GTM:

Remarketing field

And in GTM

If you are importing scripts in the remarketing field, we need to make sure that these fields only execute when they are allowed to be executed.

For example, you might want to add Hotjar in the remarketing field so you can poll and record heatmaps. Here’s an example of a default Hotjar script.

<!-- Hotjar Tracking Code for Foleon -->











This would require an opt-in for marketing cookies. We need to adjust two attributes of the script listed above.

Add the following attributes to the “<script>” element:

<script type="text/plain" data-cookieconsent="marketing">

You can do the same for statistics and preference related scripts.

<script type="text/plain" data-cookieconsent="preferences">

<script type="text/plain" data-cookieconsent="statistics">

That’s it. The script now listens to a cookie preference.

We’re almost there. We’ve prevented scripts from being executed without consent and we’ve made sure that our scripts in the remarketing field are mapped to a certain cookie preference.

The last thing we need to do is to let Foleon know once the reader has given consent through the CMP.

We recommend doing this through Google Tag Manager as it’s the easiest way to do it and because most consent platforms have an integration with GTM.

First, we need to create three variables in GTM that read the preferences stored in the cookie by the CMP. One for each category of the CMP.

Example cookie categories of a CMP:

  • Statistics;
  • Marketing;
  • Preferences;
  • Functional;

Next, we need to update Foleon with these preferences. Foleon uses three cookie categories where consent management platforms might use more.

Foleon cookie categories:

  • Statistics;
  • Marketing;
  • Preferences;

In that case, you need to choose one or combine cookie categories when mapping to the Foleon cookie categories.

The Consent Manager Platform needs to fire an event to Google Tag Manager once the user saves his or her preferences.

On this event, we need to fire the following tag in Google Tag Manager.


if(typeof CookieConsentAPI !== 'undefined') {


statistics: <Statistics Cookie Variable> || 0,

marketing: <Marketing Cookie Variable> || 0,

preferences: <Preferences Cookie Variable> || 1



} else {

localStorage.setItem("cc_settings", JSON.stringify({

statistics: <Statistics Cookie Variable> || 0,

marketing: <Marketing Cookie Variable> || 0,

preferences: <Preferences Cookie Variable> || 1




This script maps the CMP cookie preferences to Foleon and makes sure that scripts within Foleon are executed when given consent for it.

That’s it. Make sure to test your full setup on a published publication.

Related articles

Did this answer your question?