Add Analytics Tracking to Your Branding Template
  • 16 May 2024
  • 1 minute read
  • Dark
    Light
  • PDF

Add Analytics Tracking 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)

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

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

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

 


Was this article helpful?