How-To: Add analytics tracking scripts/code to your Branding Template
  • 23 Nov 2023
  • 1 minute read
  • Dark
    Light
  • PDF

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

  • Dark
    Light
  • PDF

Article Summary

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 tag near the top of the file (highlighted in the sample screenshot)

    mceclip0.png

  3. 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).

    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
  1. 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.

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

    mceclip5.png

 


Was this article helpful?