How to integrate with Google Tag Manager (GTM)?

How to integrate with Google Tag Manager (GTM)?

This is applicable only for those who implemented tags / third party plugins using Google Tag Manager.

 

Step 1: Get implementation code from your Nifty Cookie Consent account
  • Login into Your Account
  • Go to My Products > Nifty Cookie Consent - will show only if you have purchased this product
  • Navigate to the Domains tab
  • Click on View Implementation Code icon of the domain you wish to implement
  • Click on Copy button to copy the code to clipboard

 

Step 2: Add tag in your Google Tag Manager account
  • Login into your Google Tag Manager account
  • Go to Tags and click on New
  • Tag Configuration
    • Click on Tag Configuration and choose tag type 'Custom HTML'
    • In 'HTML' box, paste the code you have copied from your Nifty Cookie Consent account
    • Expand 'Advanced Settings' and select Once per page on 'Tag firing options'
  • Triggering
    • Click on Triggering and choose a trigger 'All Pages'
  • Click on Save and Give a name for the tag, eg. Nifty Cookie Consent Tag and Save
  • Once saved, you should publish the changes to take effect
    • Click on Submit
    • Give the version name and publish

 

Step 3: Modify other tags(s) to disable it if turned OFF by visitor in the GDPR compliant cookie consent dialog

NOTE: This step is applicable only if you have enabled GDPR compliant cookie consent.

Following example is to disable Google Analytics in your website if the visitor turned OFF Google Analytics in the GDPR compliant cookie consent dialog.

This step should be repeated for each tag you allow your visitors to turn ON or OFF, generally all the tags related to the apps listed in GDPR consent cookies list execpt the apps under Necessary Cookies.

  • Add variable
    • Goto Variables > User-Defined Variables and click New
    • Click on Variable Configuration and choose variable type 'Custom JavaScript'
    • In 'Custom JavaScript' box, paste below code
      function () { return NiftyCookieConsent.cookies().google_analytics.enabled; }
      NOTE: 'google_analytics' is the App name configured for Google Analytics in Nifty Cookie Consent cookies list configuration
    • Click on Save and give a name for the variable, eg. 'Nifty Cookie Consent Variable - google_analytics' and Save
  • Add trigger
  • Go to Tags and click on New
    • Trigger Configuration
      • Click on Triggering and choose a trigger 'Window Loaded'
      • Choose 'Some Window Loaded Events' on 'This trigger fires on'
        • Select the variable created in above Add variable step, 'Nifty Cookie Consent Variable - google_analytics'
        • Select 'equals' condition
        • Enter value 'true' (without quotes)
      • Click on Save and give a name for the trigger, eg. 'Nifty Cookie Consent Trigger - google_analytics' and Save
  • Link / Modify Google Analytics tag
    We assume that you have the Google Analytics Tag already configured when you setup Google Analytics in your Google Tag Manager.
    • Goto Triggers and select Google Analytics trigger
    • Tag configuration
      • Edit tag configuration and expand advanced settings
      • Select 'Once per event' in 'Tag firing options'
      • Expand tag sequencing and tick 'Fire a tag before * fires'
      • Select the 'Nifty Cookie Consent Tag' created on Step 2
      • Tick 'Don't fire * if Nifty Cookie Consent Tag fails or is paused'
    • Triggering
      • Edit triggering and remove if you have already added 'All Pages' trigger or any other trigger
      • Add and choose 'Nifty Cookie Consent Trigger - google_analytics' trigger created on Step 3
    • Click on Save
  • 0 brukere syntes dette svaret var til hjelp
Var dette svaret til hjelp?

Relaterte artikler

How to activate?

How to activate Nifty Cookie Consent? Login into Your Account Go to My Products > Nifty...

How to integrate with HTML website?

How to integrate with HTML website? Step 1: Get implementation code from your Nifty Cookie...

How to integrate with Joomla! website?

Joomla! Nifty Cookie Consent Plugin Our free Joomla! plugin will automate the integration of...

Configure website to disable the apps turned OFF by visitor in the GDPR compliant cookie consent dialog

How to configure my website to disable the apps turned OFF by visitor on GDPR compliant cookie...

Configure cookies used list for GDPR compliant cookie consent dialog

How to configure cookies used list for GDPR compliant cookie consent dialog? Step 1: Turn ON...