Google Remarketing: Privacy Compliant with Borlabs Cookie & Tag Manager

27. 01. 2020

Remarketing can be used to display more specific ads to users who have already visited the company’s website. Be it via classic display campaigns, video ads or even search campaigns.

However, because cookies are set in the user’s browser for this purpose, it is mandatory to obtain the user’s consent according to the GDPR. To obtain consent, we use the Borlabs Cookie Plugin*. Subsequently, we activate the Google Analytics Ad Features, which we only send after asking for consent via Google Tagmanager.

Enable & block Google Analytics Advertising Features

To use remarketing via Google Ads, you can use the “Advertising Features” in Google Analytics. If these are activated, data is not only sent to Analytics, but also forwarded to DoubleClick. Afterwards, remarketing audiences can be created in the Google Analytics administration interface, which can finally be played via Google Ads.

Because it is not possible to activate the advertising functions on a case-by-case basis, we take the opposite approach. We activate the advertising functions for all users, but block the data transfer to DoubleClick by default and “unblock” only those users who also give their consent.

Activate “advertising functions”

There are several ways to activate the Advertising Features. Since we mostly use the Google Tag Manager to integrate Analytics, we activate the feature via the Tag Manager for the sake of simplicity.

To do this, simply activate the Display Advertising features in your Tag or directly in the Google Analytics Settings variable by setting it there to “true”.

This basically activates the advertising features.

2. DataLayer Variable

Next, we create a new data layer variable in the Tag Manager. In principle, it doesn’t matter what we call it. However, a descriptive name is helpful. In our example, we call it something like ‘OptInGoogleRemarketing’.

It is important that we also specify a default value here and set it to “false”. Because this has the consequence that later the advertising functions are initially blocked by default.


3. Block and allow data collection

 To control data collection for advertising features that we enabled in step 1, we add another field in the corresponding tag or the Google Analytics Settings variable under the “Fields to set” and call it “allowAdFeatures“.

If the value of this field is set to “false” the data collection will be blocked. However, if the value is “true”, data will be send and advertising cookies will be set.

Since we want the value to remain flexible, we don’t write “true” or “false” here, but use our data layer variable from step 2.


–> This means now that advertising functions are still allowed, but since we have set our data layer variable to “false” by default, they are generally blocked by default.

Get user’s consent via Borlabs Cookie

We now use the Borlabs Cookie Plugin to obtain the user’s consent and subsequently set our data layer variable to true.

In the official Borlabs Cookie documentation you can find instructions on how to basically set up the Borlabs Cookie Plugin with Google Tag Manager.

In the Borlabs backend, we create a new cookie in the Marketing Cookie group and fill in the necessary information. We specify “Google Marketing Services” as the name.
The provider, as with Analytics, is also “Google LLC” and the purpose of the cookies is to “Display ads on other websites in a more targeted way, to present users only with ads that potentially match their interests.” The cookies that are set by Google or DoubleClick are usually 1P_JAR, CONSENT, IDE, NID, DV.

As opt-in code, we now fire our data layer variable and give it the value “true”:

window.dataLayer = window.dataLayer || [];
'OptInGoogleRemarketing': true,

It is important that this information is pushed to the DataLayer before the page view or our event is sent to Google. Because Borlabs Cookie fires cookies depending on the “position” of the cookie groups and cookies, we need to rank the cookie group “Marketing” BEFORE the cookie group “Statistics”. To do this, simply adjust the position value of both groups in the backend.

If the user now clicks on “Accept all” or selects both the Marketing and Statistics groups, the advertising functions blocked by default will be unblocked.



To test the correct setup, the Tag Manager Preview Mode and the rather handy WASP.insepctor Chrome plugin can be used.

If the user accepts all cookies, both "Enable Display Advertising Features" and the "allowAdFeatures" field should be set to true in the tags.
In WASP we see that the PageView goes to both and
However, if the user accepts only the cookie group "Statistics", the value of the "allowAdFeatures" field must be set to "false".
In WASP you should then see that only the tag is sent to, but should not find a DoubleClick domain.

Disclaimer: Attention! For detailed and legally sound information on the subject of the GDPR, ePrivacy or general data protection issues, you should consult an expert lawyer for data protection. We assume no liability for any resulting damages from the use or non-use of the information on this blog. The links marked with * are affiliate links.