Skip to main content

Send Axeptio consent events to GTM

Written by Alexandre Dias Da Silva

When you activate our Google Tag Manager connector, Axeptio will send 2 events to the dataLayer with the dataLayer.push() method;

The events sent to the dataLayer:

  • consent.display: The Axeptio widget appeared on a page

  • consent.answer: The user interacted with the consent widget

Example:

DataLayer variables for consent.answer

The consent.answer event sends 2 variables to the dataLayer

privacy_consent_value

This parameter can have 3 different values:

  • full: all cookies / third-party services are accepted by the user

  • partial: some cookies are accepted by the user. Others are refused.

  • refusal: all cookies / third-party services are refused by the user

privacy_consent_type

This parameter can have 2 different values:

  • true: the user accepted at least 1 cookie / third-party service

  • false: the user did not accept any cookie / third-party service

Setting up the Google Tag Manager connector

Step 1: Creation in Google Tag Manager

Go to the Triggers menu to create 2 custom triggers:

  • Custom event: consent.display

  • Custom event: consent.answer

Go to the Variables menu to create 2 dataLayer variables

  • privacy_consent_value (In the screens: ####{{DLV - privacy_consent_value}} )

  • privacy_consent_type

Step 2: Creating your tag

We will see in detail, with simply a console.log to display the variables being sent and then we will see with the Google Analytics tag.

Integration with Google Tag Manager allows you to send to any other tag. We have triggers and variables available. You are not limited to Google products at all.

With a simple console.log();

When the user interacts with Axeptio, the consent.answer event is sent, which is what will serve as the trigger.

We add a custom HTML tag to display in the console the name of the event and the value of privacy_consent_value.

<script>console.log( 'Event : ####{{Event}} , Privacy Consent Value : ####{{DLV - privacy_consent_value}} ');</script>

Result

With Google Analytics 4

Add an event tag that will have consent.answer as a trigger (This works of course with consent.display)

There are 2 dataLayer variables created with consent.answer that we pass as event parameters in order to send them to Google Analytics.

Configuration to add the 2 dimensions in your Google Analytics 4 interface.

By going to the settings/administration section of your Google Analytics account, in the custom dimensions section.

Here is the result:

dimension-personnalisee.png

Verify the setup

You can launch a preview of your website. The Google Analytics debug_mode parameter will be active. If you are only using Gtag, add debug_mode to your configuration.

In Google Analytics, go to DebugView

In another window, use the preview version in Google Tag Manager to display your website. After a few seconds, you will see your visit in Google Analytics and you will have the events sent by Axeptio.

The Axeptio events

debug\_view.png

Detail of the consent.answer event

consent answer.png

Display your statistics in Google Analytics Explorer

You now have additional data that is recorded in Google Analytics. In the explorer section, you can create your dashboards.

Display of the number of widgets displayed = Total of consent.display events

Interaction with the consent widget = Total of consent.answer events

You can thus calculate your consent rate, interaction rate and analyze the impact on your website.

Expansion with all tags

Google Tag Manager is a container, you can trigger and send this information to any partner that allows you to analyze your website. As we saw with the console.log, the data is available, you can send it wherever you want.

Did this answer your question?