You can implement Google Tag Manager for your help center.
About Google Tag Manager
According to Google, "Google Tag Manager is a tag management system that allows you to quickly and easily update tags and code snippets on your website or mobile app, such as those intended for traffic analysis and marketing optimization. You can add and update AdWords, Google Analytics, Firebase Analytics, Floodlight, and 3rd party or custom tags from the Tag Manager user interface instead of editing site code."
Implementing Google Tag Manager
Sign up for Google Tag Manager
First, you need to sign up for a free Google Tag Manager account.
- Sign up for Google Tag Manager for free.
- Set up a new account.
Be sure to select Web as Where to use the container.
- Once your new container is created, copy the two snippets of code to embed in your help center.
Add the embed code to your help center
Now you'll paste the embed code from Google Tag Manager into two templates in your help center theme.
- In Guide, click the Customize design icon () in the sidebar, then click Edit theme.
- Paste the first snippet in the Document Head (document_head.hbs) template.
- Paste the second snippet in the Header (header.hbs) template.
- Save your changes.
Create your tag in Google Tag Manager
From here you’ll need to create a tag to test out in your new container.
- Select Add a New Tag in your workspace in Google Tag Manager.
For the example here, we’ll just set up a new Custom HTML tag, but Google Tag Manager provides templates for a bunch of third party tags like AdWords, Google Analytics, Google Optimize and more.
- Create a new Custom HTML tag with a simple script tag and an alert to verify that your changes are being brought into your help center and set it to trigger for All pages on page view.
- Once you have your new tag, click Submit on your Workspace.
- Select Publish and Create Version and give your container a new version name and description, then click Publish.
View changes in your help center
Now you can see the tag you built in your help center.
- Go back to Guide and refresh the preview of your help center.
- See the alert that you built in your Custom HTML tag.
Now, you’ve configured a container and an example tag from Google Tag Manager and embedded it into your help center.
Google Tag Manager is an incredibly powerful tool for managing analytics and traffic performance tools. Google has put together a lot of resource on use and best practices with Google Tag Manager here.