- 16 May 2024
- 1 minute read
- Print
- DarkLight
- PDF
Add Analytics Tracking to Your Branding Template
- Updated 16 May 2024
- 1 minute read
- Print
- DarkLight
- PDF
You can include your analytics tracking script, such as Google Tag Manager, Facebook, Capture, or others, in your Slate branding template by going to the 'shared' folder in the File Editor. Find the main build.XSLT file of the branding template.
Add Scripts/Code
Click on the /shared/build.XSLT to pop up the 'Edit File' view.
Find the tag near the top of the file (highlighted in the sample screenshot)
Place your script above the closing tag
In this example - Above line 20 (the contents inside the will vary from template to template - concentrate on finding the closing tag).
Copy the code you received from the analytics installation instructions or your Marketing folks
Paste the full script into the file.
If you attempt to save this file, you will encounter a browser error stating something like "'src' is an unexpected token. The expected token is '='. Line 17, position 15.".
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxx-x"></script
Make the change as indicated below (using, of course, your own UA property ID).
The Slate-based file editor is expecting valid XHTML code. In this case, it is important to remember that in XHTML, attribute minimization is forbidden, and attribute values must always be quoted.
See W3 Schools - HTML Versus XHTML for additional information.
Save the file (at the bottom of the pop-up window), and you are done.