Add Contentsquare tracking to your knowledge base

Last Update: Oct 2024 Est. Read Time:
To check plan availability, see the pricing page.

Contentsquare is a digital experience analytics software that allows users to track customer activity on specific websites. These insights can be used to see how many people visit your knowledge base, which articles get the most traffic, and which articles could use a little work. Contentsquare also allows users to visualize how customers interact with different elements on their site to better understand the customer journey.

This article explains how to implement Contentsquare's tracking tag in your knowledge base.

Who can access this feature?
User typesContent administrators can access the Themes page.


In this article

Prerequisites

You must have access to a Contentsquare account before this can be set up in your knowledge base.

You'll also need the Contentsquare Tag ID that was provided when setting up your account.

Add tracking tag to your theme

  1. Go to Settings> Knowledge Base > Themes.
  2. Select the theme your knowledge base is using. If the chosen theme is using the visual editor, open the More Options menu and select Go to Code Editor.
  3. Select Create New Draft.
  4. Select Add to create a new file. Give it the following properties:
    • Theme Target: Global
    • File Name: Contentsquare
    • Field Type: JS
  5. Enter the following code in the editor:
    window.addEventListener('DOMContentLoaded', (event) => {  
    const mt = document.createElement('script');
      mt.async = true;
      mt.src = "//t.contentsquare.net/uxa/<YOUR_TAG_ID>.js";
      mt.type = "text/javascript"
      document.getElementsByTagName('head')[0].appendChild(mt);
    
    });
  6. In the above code, replace <YOUR_TAG_ID> with the Contentsquare Tag ID.
  7. Select Save and Publish

Once this change has been implemented, data should begin flowing into Contentsquare within three hours.