How-To: Add analytics tracking scripts/code to your Branding Template

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

1. Click on the /shared/build.XSLT to pop up the 'Edit File' view.



2. Find the <head> tag near the top of the file (highlighted in the sample screenshot)

 

mceclip0.png

3. Place your script above the closing </head> tag

In this example - Above line 20 (the contents inside the <head> will vary from template to template - concentrate on finding the closing tag).

mceclip2.png

4. Copy the code you received from the analytics installation instructions or your Marketing folks

Paste the full script into the file.

mceclip0.png Example Google Tag Manager (GTM/Gtag)

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>

5. Make the change as indicated below (using, of course, your own UA property ID).

 

mceclip1.png


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.

6. Save the file (at the bottom of the pop-up window), and you are done. 

mceclip5.png

 

Was this article helpful?
6 out of 7 found this helpful