Upload data through Google Tag Manager

Overview

With Sitefinity Insight, you can easily integrate Google Tag Manager (GTM) to collect data and track specific user behavior. In case you are already working with the Tag Manager, you can use your existing triggers and create custom HTML tags to enable Sitefinity Insight to collect data when your tags fire. For more information, see Google Tag Manager.

NOTE: Using Google Tag Manager, you can collect data with Sitefinity Insight from any system, not just from Sitefinity CMS.

PREREQUISITES: Register a Google Tag Manager account and create a container. For more information, see the Setup and install Tag Manager documentation.

Prepare pages to track

To track a new or existing page, you need to inject the Google Tag Manager code in all pages you want to track. This code is responsible for firing your tags.

In case you are working with a Sitefinity CMS instance, you can:

  • Track all pages on a site by putting the Google Tag Manager code in the Master page.
  • Track individual pages by placing the script in the <head> section of the page. To do so, navigate to Actions » Title & Properties » Advanced options » Page templates » HTML included in the <head> tag.

An example of tracking interactions in a Sitefinity site with the help of Google Tag Manager is clicks on page elements that are within the class=”sfPublicWrapper” class.

Configure Google Tag Manager

To enable Sitefinity Insight to track clicks, for example, you need to configure the following:

  • Trigger
    The trigger fires all of its related tags anytime a visitor clicks on a page element within the class=”sfPublicWrapper” class.
    For more information, see Tag Manager Triggers Google documentation.
  • Custom HTML tag
    The tag code is executed when the trigger is fired and enables Sitefinity Insight to receive data upon visitors clicking on the specified elements.
    For more information, see Tag Manager Custom tags Google documentation.

The following section describes how to use Sitefinity Insight JavaScript SDK to track client-side behavior both on Sitefinity CMS and non-Sitefinity CMS pages. For more information about the SDK, see Capture client-side behavior with JavaScript SDK.

Use custom tag to track page visits

To track page visits on your sites with Sitefinity Insight and Google Tag Manager, you need to use the Sitefinity Insight JavaScript SDK. For more information, see Capture client-side behavior with JavaScript SDK.

Your custom HTML tag needs to have content similar to the following:

IMPORTANT: Your Insight JavaScript SDK version must be 3.1.5 or higher.

If you have multiple GTM tags, you can reuse configurations and bundle requests together by using a single instance of the JavaScript SDK in all of your tags. To do this, create an additional custom HTML tag that is fired on all pages and initializes the JavaScript SDK in it.

Test the integration

To test whether Sitefinity Insight receives interaction data and verify the integration is properly configured, you can just open a tracked page in a browser and complete the tracked interaction, for example, click on an element within the specified class. You can look at the Network tab of the browser Developer tools and verify there are requests to the Sitefinity Insight API servers.

Next, you can look at your data center in Sitefinity Insight and see the tracked interactions in the Journey timeline of known contacts.

Was this article helpful?