Filipe Lourenco : Set statistics on specific pages using HMTL and GTM

When inserting our script via HTML, our statistics if enabled will capture the data on all pages, so if a user want to have the statistics on only specific pages, it will need to make some changes on our script and on the page that needs the tracking.

Our script when statistics enabled looks like this:

<script type="text/javascript">
    window._monsido = window._monsido || {
        token: "xxxxxxxxxxxxxxxxxxxxx",
        statistics: {
            enabled: true,
            documentTracking: {
                enabled: false,
                documentCls: "monsido_download",
                documentIgnoreCls: "monsido_ignore_download",
                documentExt: [],
            },
        },
    };
</script>
<script type="text/javascript" async src="https://app-script.monsido.com/v2/monsido-script.js"></script>

This part will need to changed and we should also add track_on_load: false .This will disable the statistics from loading when the script is added to the HMTL.

The script to implement should be:

<script type="text/javascript">
    window._monsido = window._monsido || {
        token: "xxxxxxxxxxxxxxxxxxxxx",
        statistics: {
            enabled: true,
               track_on_load: false,   <----------------- to be added
            documentTracking: {
                enabled: false,
                documentCls: "monsido_download",
                documentIgnoreCls: "monsido_ignore_download",
                documentExt: [],
            },
        },
    };
</script>
<script type="text/javascript" async src="https://app-script.monsido.com/v2/monsido-script.js"></script>

Now that the statistics are prevented to track on loading, the user will need to have a way to make sure the statistics will collect data on specific pages, and for that, the user should add on that page’s HTML:
window.monsido_tracking.trackUrl(window.location.href);

How to exclude Monsidos script on specific pages using Google Tag Manager 

There are cases where the user does not want to have the Monsido's script or the consent manager script (tags) loading on certain pages.

Assuming that the user already created the Monsidos tag, this guide will help you how can you exclude that script (tag) using the Google Tag Manager.

 Step 1 - Add a new trigger

Login into your Google Tag Manager, click on the left of the dashboard where says Triggers.After you will need to click on New in order to create a new Trigger

Inside the Trigger click on the icon in the middle of the Trigger Configuration window.

A new side banner will appear and there the user should select Page View

After will return to the Trigger Configuration and you need to make sure to select the next configuration:

Page View set on Some Pages Views
Fire on: Page URL /Contain/ URL of the pages the should excluded
And click on the button Save to finalize the proccess
Note: URL of the pages the should excluded should be for example https://monsido.com/contact

Step 2 - Add the Trigger to the tag as an exclusion

Since the trigger is created now the user should be able to add that Trigger to the tag so that the tag won´t load on that specific page.

Click on the tags and select the tag. After the user should hover over the Triggering section and click the pencil icon.

After that, the triggering configuration will display the option to Add Exception and the user should click there.

A new side banner will appear and there the user should select the Trigger that was created previously for the exclusion of the page

To finalize click Save on the tag and publish your Google Tag Manager.

Attachments:

0vsDlyNorB2FXXMUOiiDAY9d2b93PORgcYjHswH1tni1_28-vzRZee7ujjWaQmWdE5N2XVh9pDnPRiIhNN8_AohxDjuXFTzb3jfLN0aikC7HV960fMcW_6t4KoOO8Xla3cmDDZP-Knxul5aon1KSU7ulTVLUCjyp-ZAcYgMtgbM4x1bkNSLcMurx (image/png)
QWX37lcO9_zneV4kun8Rg3a01MQjQCbqaiDEzo7lVe2ucdDJ5kXJLshFIdiUbU0-NaxR0b5MBDJW3BP5UXxtKvQvmm3fz99XnbPeI_0Mb291zem9LCqL_YH6s7MfQnBxDD8tBhP7F_1wG-Eti_Z5vERlRwczK7Tu1khoJ-yZNgbhLr86xcGNZnY1 (image/png)
gPjIntH0i_n8pdX9IX-ChxVNBVVpMoobJ8K-KSjoLm29Roue_zCByUWj4PXkxSg20TqV9W07B-MyitcN7R8sy1N5d7RdUuQa_zRIaSUwgbCJR8nVll0iwfQevHev4ISeMzbTJElZBzG-qO92tU3b0lPHmmzyN-92p7MbJLwq4R9gxNAXb_GoDpTQ (image/png)
DiBUC4_F5cLaHa6txAzq9gy2iSYoWLLRsRhgvHZB2DveZuFNY5Kz14-42XWZLvyYbY5fjd3iLudTcD6Cxhj_fs4FeFmJolDVXoPaJFbbIpW_33vjCELM0H2OpX_NwTQwl8lmSjDpmqtR2PiWJWu0kiQ0bUkcGPXLao1T9R6zFTxYnO3mVrMinoVD (image/png)
chS7apbgBH7ksj80KJTSBZ-vwQEHsbxBdDsosEGdC8WUxAsCx38YXKrC8PfZhDK-NBu8cGx1YYNRGc-b6M8O6we7USFt-4xjmYy4z_6qT6sWG-6T_l1FL-qLh7r7ds7Eizzlz5k5x4nL5A111FXFnN7RUpyVhA9c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