Skip to content
OpenCart · User manual

Google Consent V2

Version 1.0.1 Product page
Chapter 5

Google Tag Manager setup

How to import the workspace included with the extension into Google Tag Manager and make your Google tags wait for the visitor's consent.

Why Google Tag Manager is needed

The popup stores the visitor's choice and announces it to Google Tag Manager with the event googleConsentUpdate. Google Tag Manager then tells your Google tags which consent types are granted. Without Google Tag Manager in your shop, the popup still appears, but the choice does not reach any tag, and your browser console shows Google Consent V2 error: Google tag manager tag not found.

Your Google Tag Manager container must already be installed in your shop, by your theme, another extension or code you added.

Download the workspace

  1. Open Google Consent V2 in your administration.
  2. Press Quick Tutorial, under Status. The SETUP TUTORIAL window opens.
  3. In Step 1, press the link to download the workspace. The file is google_consent_v2_workspace.json.

Import it into Google Tag Manager

  1. In Google Tag Manager, open the container of your shop and go to Admin > Import Container.
  2. Choose the file google_consent_v2_workspace.json.
  3. Choose the workspace to import into, select Merge and keep your existing tags.
  4. Confirm the import.

The import adds these elements to your container:

TypeNameWhat it does
TagCookies consent mode - Default settingsOn every page, before any other tag, sets all consent types to denied.
TagCookies consent mode - Accepted cookiesUpdates the consent types with the visitor's choice, when the page loads for a visitor who already answered and each time a visitor answers.
TagCookies consent mode - Settings appliedRuns right after the previous tag and sends the event that starts your other tags.
TriggerCookies not accepted and Cookies acceptedConsent initialisation triggers that check whether the visitor already answered the popup.
TriggerConsent settings changedFires on the event googleConsentUpdate sent by the popup.
TriggerConsent settings appliedFires once the consent has been applied. Use it for your own tags.
VariablesGoogle Consent - Popup accepted and Google Consent - var followed by a consent typeRead the choices stored by the popup in the visitor's browser.
TemplateConsent Mode (Google tags)The tag template used by the two consent mode tags.

Connect your tags

For every tag that depends on consent, such as Google Analytics 4, Google Ads conversions and remarketing, and the conversion linker:

  1. Open the tag in Google Tag Manager.
  2. In Triggering, remove its current page trigger (for example All Pages or Initialization - All Pages).
  3. Add the trigger Consent settings applied.
  4. Save the tag.

Tags that must fire on a specific event, such as a purchase, keep their own trigger. Google's consent mode then decides what they may store.

Publish

Press Submit in Google Tag Manager and publish the new version. The changes reach your shop as soon as the version is published.

Which consent types each category controls

Category in the popupGoogle consent types
Necessarysecurity_storage (always granted)
Preferencesfunctionality_storage, personalization_storage
Statisticsanalytics_storage
Marketingad_storage, ad_user_data, ad_personalization

Still need help?

Open a support ticket from your account and our team will look at your store with you.