No items found.
Page title

Collecting consents using Tag Manager

Set up seamless cookie tracking with Easycookie and Google Tag Manager, ensuring compliance with Google Consent Mode v2.

Last updated
September 14, 2024

Here’s how to set up proper cookie tracking using Easycookie and Google Tag Manager.

Important! If possible, add the Easycookie script to your site first, then configure settings and rules in Google Tag Manager. Otherwise, the configuration will be more challenging and require additional steps.

Rule configuration

Before Google Consent Mode v2, the rule triggering cookie tracking on the site was page initialization. Now, proper configuration requires suspending any tracking and GA tag initialization, until user consent is given. To do this, we are going to create new triggers and add them to the main Google tag.

  1. Log in to Google Tag Manager.
  2. Go to the Triggers section.
  3. Click New to add a new trigger.
  4. Add a DOM Ready trigger—select DOM Ready as the trigger type and toggle the option to fire trigger on All DOM Ready Events.
  5. Add a ContentUpdate trigger—select Custom Event as the trigger type, enter the name ConsentUpdate, and toggle the option to fire the trigger on All Custom Events.
  6. Go to the Tags section and find the main Google tag. Remove initialization trigger firing on all pages.
  7. Replace it by adding the two triggers you just created—DOM Ready and ConsentUpdate.
  8. Go to the Advanced Settings in the tag configuration.
  9. In the Consent Settings section, check Require additional consent for tag to fire
  10. Click +Add required consent and set it to analytics_storage.
If you don’t see the Consent Settings section, go to Admin -> Container Settings and in the Additional Settings section, toggle on the option Enable consent overview.

This configuration ensures that the GA4-triggering tag loads only when there’s information on the consents given by the user. Simultaneously, the Easycookie script loads the tag on the first page the user visits, making it possible to correctly determine the source from which the user entered the site while adhering to Google Consent Mode v2 rules.

Assigning consents to events

If you have additional tags in your GTM sending events to GA4, you need to assign the appropriate consents to each element. You can do this individually or collectively.

Single tag configuration

  1. Go to the Tags section.
  2. Open the tag to which you want to assign consent.
  3. Go to Advanced Settings -> Consent Settings.
  4. Check Require additional consent to trigger the tag.
  5. Click +Add consent requirement and set it to analytics_storage.
  6. Click Save.

Bulk configuration

  1. Go to Consent Settings Overview (you can do this by clicking the shield icon next to the New button).
  2. Select the elements to which you want to assign consent.
  3. Click the shield icon in the upper right corner to go to the Edit Tag Consent view.
  4. Check Require additional consent to trigger the tag.
  5. Click +Add consent requirement and set it to analytics_storage.
  6. Click Save.
Important! For elements related to ads, sending information to Google Ads or Meta, you also need to add additional consent of type ad_storage. If you use personalization features, also add consent of type personalization_storage. More information about configuring individual consents can be found in Google’s documentation.
Get started with Easycart
Get started with Easycart
Fees and payment methods
Fees and payment methods
Migrating from other tools
Migrating from other tools
Checkout
Checkout
Prices
Prices
After purchase
After purchase
Digital downloads
Digital downloads
Checkout recovery
Checkout recovery
Discounts and upsells
Discounts and upsells
Policies, GDPR, Taxes
Policies, GDPR, Taxes
Affiliates
Affiliates
Analytics and ads
Analytics and ads
Waitlist
Waitlist
Automations and Integrations
Automations and Integrations
Orders and Customers
Orders and Customers
Webhooks
Webhooks
API
API
Pricing pages with Easyoffer
Pricing pages with Easyoffer
Testimonials with Easylove
Testimonials with Easylove
Legal pages with Easylegal
Legal pages with Easylegal
Video courses with Easyplayer
Video courses with Easyplayer
Cookie notifications with Easycookie
Cookie notifications with Easycookie
Donations with Easycoffee
Donations with Easycoffee
FAQ pages with Easyfaq
FAQ pages with Easyfaq
Time counters with Easytimer
Time counters with Easytimer