Google Tag Manager (GTM)

In order to use consent information with Google Tag Manager (GTM), the CMP will push so called data layers into GTM. The CMP will create the following data layer variables:




0 if GDPR does not apply, 1 if GDPR applies


Sets the IAB consent string


Sets a comma separated list of vendor IDs that got consent, e.g. ,3,7,22,31,88, (list starts and ends with comma)


Sets a comma separated list of custom vendor IDs (vendors that are not part of the IAB global vendor list) that got consent, e.g. ,82,112,556, (list starts and ends with comma)


Same as cmpVendorsConsent but included are the Google ATP IDs.


Sets a comma separated list of purposes that got consent, e.g. ,1,2,3,4,5, (list starts and ends with comma)


Sets a comma separated list of custom purposes that got consent, e.g. ,1,2,3,4,5, (list starts and ends with comma)

How to create blocking rules in GTM?

In order to display certain codes only if consent is given, please follow these steps:

  1. Create variables in GTM: In GTM go to Variables > New and click on configure:

  2. Choose variable type Page Variables > Data Layer Variable, set the Variable Name to cmpGDPR, cmpVendorsConsent or any other variable name as from the table above:

  3. Repeat the steps above for all other variables that you require (usually cmpGDPR, cmpVendorsConsent, cmpCustomVendorsConsent)

  4. Go to Triggers > New and click on configure:

  5. Use event Name cmpEvent and add custom events to it:


  6. For each event at least two rules are necessary: cmpGDPR equals 1 and cmpVendorsConsents contains ... or cmpCustomVendorsConsents contains ... (see next step).

  7. Set the event rules to cmpVendorsConsent contains ,x, where x is the ID of the vendor and/or cmpCustomVendorsConsent contains ,x, where x is the ID of a system- or custom vendor (vendor-IDs that start with "c" or "s"). The IDs for the vendors can be found under menu Vendors/Whitelist:

    Important: Always only use one vendor per trigger (... contains ,x, and not ... contains ,x,y,z,). If you are working with multiple vendors, create multiple trigger and one trigger per vendor.
    Important: Ensure that you are using the correct variable. All vendors that begin with s or c can be found in variable cmpCustomVendorsConsent. All vendors without s or c can be found in cmpVendorsConsent.

  8. Repeat the above step for each vendor and create a new trigger for each vendor

  9. Apply the trigger to your tags and ensure that the tags do not fire with pageView event but only with the cmpEvent:

    Important: Ensure that the trigger is the only trigger for each tag you are using. Do not combine triggers with other triggers/events like "All pages" or "On page load" and so on.

Example: Blocking Google Analytics with Google TagManager (GTM)

Here are some example screenshots how a setup would look like in order to block Google Analytics if no consent is given.


a) Trigger Google Analytics on all pages when consent is given:

b) (optional) Trigger Google Analytics on Thank-You page after an order has been placed:


Google Analytics Tag with assigned Triggers (second trigger is optional):

How to block the Google TagManager Code if no consent is given?

If you not only want to block the codes within the TagManager but also the TagManager itself, you can do so by following these steps:

Your GTM code will look somehow like this:

        new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],

In order to allow the CMP to block and only enable the code on consent you will need to change the code in the following way: (see changes in <script ...> part of the code)

<script data-cmp-vendor="s905" type="text/plain" class="cmplazyload" >(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
        new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
Back to top