Skip to main content
All CollectionsTracking scriptsCustom integrations
Implement the Datatrics tracking script in Google Tag Manager (MPA version)
Implement the Datatrics tracking script in Google Tag Manager (MPA version)

This article explains how you can implement the Datatrics tracking script on your website via GTM if you have a multi-page website.

Christiaan Proper avatar
Written by Christiaan Proper
Updated over a week ago

If you have a website where the page reloads every time the content changes (the classical approach to web development, also known as Multi-Page Applications (MPAs), this is the right guide for you. If your website doesn’t reload for every page view and when content changes, your website is a Single Page Application (SPA). If your website is a Single Page Application, please follow this guide.

Log in to Google Tag Manager and ensure you are in an empty workspace. If workspace changes are not yet submitted, like in the screenshot below, contact the user who made the changes if the changes can be reversed or published. This will prevent you from publishing unwanted changes to your Google Tag Manager container. You can also create a new workspace where you only work on these changes and publish them.

Now log in to Datatrics and head over to the website integration. Click on the Edit button like shown in the image below:

On the next page, click on Tracking Script and copy the code that appears below:

Head back to Google Tag Manager and create a tag (1), choose Custom HTML as a tag type (2), paste the Tracking Script you just copied in the HTML code field (3), add All Pages as a trigger (4), and save the tag (5).

Checking if the implementation is correct

To check if everything is working correctly, you can preview the changes from your container in the Tag Assistant and see if the newly added tag fires correctly on every page view:

Navigate your website and check if this tag fires every pageview.

Publishing your workspace to the live environment

After saving, don’t forget to publish the changes by clicking on the blue Submit button in the top right corner. After clicking GTM prompts a confirmation window where you can enter a title and subscription for the changes:

Publish it and sing like no one is listening. You now added the Datatrics tracking script to your website!

It’s recommended to also send over e-commerce data to Datatrics via Google Tag Manager if this data is present in GTM. Please continue reading this article to set this up:

Did this answer your question?