Advanced setup with Google Tag Manager

You want to create conditional controls for your tags triggers

1. Add an on-click cookie on an element, based on user choices.

You wish to trigger the deposit of a cookie when there is a click on a specific element of your page. User case: You wish to trigger the deposit of a cookie on click on the "download the booklet" button, but only if the user agreed with the deposit.

You wish to trigger a tracking cookie if the user clicks on the button
But before that you want to check user consent

3. How can I do it?

A - Create a variable

Connect to your Google Tag Manager account, then go to Variables, and create a new "User-defined Variables".

Click on "Variables" then "New"

Choose "1st Party Cookie" as your variable type.

Choose "1st Part Cookie"

Name your tag, then in the "Cookie Name" box write: axeptio_cookies and check the "URL-decode cookie" box.

Configure your variable

Congratulations, your variable is now created!

B - Define two trigger conditions

Go back to the tags you want to modify or create new ones.

Choose the tag you want to modify

In the "Triggering" part, create a new trigger.

Create a new trigger

Select "Just Links" type.

Trigger when a link is clicked

Once this is done, you can condition the tag trigger with the user consent, with the help of our Axeptio variable and the "Vendor": true nomenclature, and by setting the maximal waiting time to 1 millisecond.

Conditional trigger

Finally, you can choose to trigger this tag on click on a specific class and on the URL

Warning, the specified class should be unique

4. Google Tag Manager Debug

If you have the slightest problem about locationg your class or elements that you want to track on GTM, you can use the debug mode on your website, that will show all elements detected by GTM when there is a click on your website.

Variables choice

To activate this mode simply go to your GTM and click on "Preview".


Congrats ! You can trigger all your actions in accordance with user choices and preferences.