Use Google Tag Manager with a published Confluence site
To use Google Tag Manager with a Confluence site published with Capable Sites, paste your container ID (GTM-XXXXXXX) into Google Tag Manager ID under Settings, Integrations. If you use the cookie banner, also turn on Tag Manager handles consent and trigger tags from the capable_consent events. Save, then Update and Promote.
#Before you start
You need to be a Confluence admin or a collaborator on the site, and able to publish your Tag Manager container.
Find the container ID in Tag Manager under Admin > Container Settings.
Tags in the container can only load scripts from Google. Tags that load scripts from other providers do not run on a published site.
#Steps
In Capable Sites, open your site, select Settings, then the Integrations card.
Paste your container ID into Google Tag Manager ID.
If you need consent, turn on Cookie consent popup, then turn on Tag Manager handles consent.
Select Save changes, then select Update and Promote on the site's Overview.
In Tag Manager, open Admin > Container Settings and select Enable consent overview under Additional Settings.
Create a Custom Event trigger for each category you use, with the event name
capable_consent_analytics,capable_consent_marketingorcapable_consent_functional.For Google tags, open Advanced Settings > Consent Settings and require the matching consent type, such as
analytics_storageorad_storage. For other tags, replace All Pages with the matching consent trigger.Select Submit to publish the container.
Open your site in a private window, select Accept all, and type
dataLayerin the browser console to see thecapable_consentevents.
#If it does not work
The container never loads for visitors who customise. Tag Manager handles consent is off, so the container waits for Accept all. Turn it on.
A tag fires before consent. Its trigger is still All Pages or Initialization - All Pages. Swap it for the consent trigger.
A third-party tag never runs. Its script comes from outside Google and is blocked. Contact Capable support if you need a provider allowed.
#Related
Integrations and cookie consent
Consent types, events and what each integration stores.
Add a cookie consent banner to a Confluence site
Turn the banner on first.
Chat widget / marketing tag / third-party script does not run on the published site
When a tag stays silent.
Analytics, cookies and consent
More analytics and consent guides.
Set up consent once, in your container, for every page.
