Google Tag Manager
Connect Google Tag Manager (GTM) to your published docs to add analytics, marketing and tracking tags without editing any code. Once GTM is connected, you manage tags like Google Analytics, ad pixels or chat widgets from your GTM account, and they run on every public page of the collection.
#
Before you start
- Create a container in Google Tag Manager for your docs site, or reuse your website's container.
- Copy your container ID. It looks like
GTM-ABC1234. - Publish your collection so you can test the tags. See Publish Pages.
#
Add your GTM ID
- Open the collection and click Settings in the left sidebar.
- Open the Google Tag Manager tab.
- Under Google Tag Manager ID, paste your container ID in the
GTM-XXXXXXXfield. - Click Save.
You see "Saved & Published Successfuly", and the GTM container loads on your public pages right away.
The ID must use the format GTM- followed by 6 to 8 capital letters or numbers. If it doesn't, you see "Invalid GTM ID. Format: GTM-XXXXXXX (letters/numbers only)." Check for extra spaces or lowercase letters.
#
Check that it works
- In Google Tag Manager, click Preview and enter your docs site URL.
- Open a few pages and confirm your tags fire.
- Publish your container in GTM so the tags go live for all readers.
#
Why use Google Tag Manager
- One place for all tags. Add, change or remove tracking without touching your docs.
- Use what you already have. Reuse the tags and triggers you set up for your website.
- Fewer mistakes. Test tags in GTM preview before readers see them.
#
Tips
- To change containers, paste the new ID and click Save.
- Use GTM for scripts instead of putting them in your header and footer. It keeps your header clean and your tags easy to manage.
- Tags run on your public docs only, not inside the DocStar editor.
- Make sure your tracking follows your privacy policy and any cookie consent rules for your readers.
- DocStar also has built-in reading stats. See Analytics.
Was this helpful?