Advertising features in Google Analytics are hugely useful for creating remarketing audiences. However, to comply with GDPR, it is necessary to block these features in some cases: to ensure that users always opt in before you collect, store, or use their data. In just a few steps, you can both enable and block advertising features.

Adding Advertising Features

To enable remarketing and advertising reporting features for a property, you’ll need to have edit permission for that property. You’ll also need to agree with the Analytics Terms of Service — if you haven’t since these terms last changed. Finally, you’ll need an active Google Ads or Display & Video 360 account linked to your Google Analytics account. In the case you want to use Google Ads, you’ll need to add your audiences to an ad group.

Once you’ve done this, you have a variety of options to add advertising features.

Update Property Settings

The first solution is to modify your property settings — this is the only way to use the Analytics tag to create remarketing lists. To do so, head to “Admin” and choose “Property.” Then, click on “Tracking Info” and select “Data Collection.” Here, you can turn on both remarketing and advertising reporting features or just the second option.

Modify Tracking Code

The above method will apply to all pages and is necessary if you want to enable remarketing lists for search ads. If you want to apply advertising features to just some pages, however, keep the property settings toggled off and modify your tracking code instead. Insert the following between the “create” and “send” commands:

ga(‘require’, ‘displayfeatures’);

Load the Displayfeatures Plugin

If you are using analytics.js, an alternative is to load the displayfeatures plugin, which uses this command:

ga(‘create’, ‘UA-12345-1’);

ga(‘require’, ‘displayfeatures’);

ga(‘send’, ‘pageview’);

 

The require command functions the same as property settings. The difference is now you can decide when you want the plugin to load.

Use Google Tag Manager

Yet another method is to enable display advertising features in Google Tag Manager. Under “Advertising,” set the option to true.

Use Existing Tracking Code

A final alternative is to use existing tracking code. This is an option if you are creating a Google Ads remarketing campaign with an account linked to your Google Analytics account. By using the tracking code already on your website, remarketing is automatically enabled in Google Analytics.

Blocking Advertising Features

To ensure that you comply with GDPR, you need to gain consent from users before you can keep, store, or use their data. This means that you are unable to remarket to users unless they opt in.

To block advertising features for all users, you can toggle off the property settings, ensure that tracking code is not configured to collect data, or set your Google Tag Manager tag to false. However, if you want to enable advertising features according to user consent, you should use one of two methods, analytics.js or Google Tag manager:

Analytics.js

For analytics.js, use the following code:

ga(‘create’, ‘UA-12345-1’);

if (checkUserConsent() === ‘NO’) {

 ga(‘set’, ‘allowedAdFeatures’,);

}

ga(‘send’, ‘pageview’);

This will block advertising features whenever checkUserConsent() returns “NO.”

Google Tag Manager

Alternatively, you can use Google Tag Manager. Head to “More Settings” and then “Fields to Set.” Create a new field with the name “allowAdFeatures” and the value “true/false.” Then, use a variable that checks for user consent and returns either true or false.

Configuring advertising features is critical if you want to improve your remarketing efforts and ensure that you comply with GDPR. The good news is that there are several methods to use, allowing you to find whatever is easiest for your site.