Articles in this section
Category / Section

Double Server for the Same Website

Using GTM to track data from the same website with two servers

If you want to set up two data-servers for your website for whatever reason, different configurations, multiple ad-accounts, opposite consent modes, you can do so by setting up two data-servers for you website. This is done by duplicating your Tracklution tags in GTM and adding the target parameter to your duplicated tags with your second container's Tracklution ID.

1. Start with your standard setup

Create a Tracklution container and use the Tracklution GTM template (or the cHTML method) to track your events as you normally would.

Tip: Create variables in GTM for your Tracklution ID, for your Tracklution Domain, and prepare a variable for your second Tracklution ID.

Select Variables, under User-Defined Variables click NewVariable Configuration Constant → Value, add your Tracklution ID or Domain, give the GTM variable a name and click Save.

2. Add a second Tracklution container

  1. Create a new Tracklution container.
  2. Note the second Tracklution ID (e.g. LS-11111111-2).

3. Modify GTM to track events in both containers

In GTM, for each tag you want to use to collect events and data with both containers, copy the tag and add the target parameter to the copy.

The parameter is added to your copy by selecting Custom Parameters and adding Key: target (lower-case) and Value: your second Tracklution ID (or the variable containing it).

custom_parameter

Examples using the cHTML method

OBS! Unless the main script is hardcoded on your site, with the cHTML method you need to have a tag with the main script triggered on all pages. This tag does not need to be duplicated, but if it includes the PageView event, you need one new PageView tag separately with the target parameter for your second Tracklution container.

To duplicate a PageView:

<!-- Original tag -->
<script>
  tlq('track', 'PageView');
</script>

<!-- Duplication -->
<script>
  tlq('track', 'PageView', {target: 'LS-11111111-2'});
</script>

Tip: GTM variables can be used in cHTML tags as well. To make this setup more flexible in GTM, you could replace the second Tracklution ID (LS-11111111-2) with a constant variable (e.g. {{Tracklution ID 2}}) containing the value of the second Tracklution ID.

Purchase event example (with GTM variables):

<!-- Original tag -->
<script>
  tlq('track', 'Purchase', {
    value: {{DLVvalue}},
    currency: '{{DLVcurrency}}',
    transactionId: '{{DLVtransaction_id}}'
  });
</script>
<script>
  tlq('set', 'ContactInfo', {
    email: '{{DLVemail}}',
    phoneNumber: '{{DLVphone}}'
  });
</script>

<!-- Duplication -->
<script>
  tlq('track', 'Purchase', {
    target: '{{Tracklution ID 2}}',
    value: {{DLVvalue}},
    currency: '{{DLVcurrency}}',
    transactionId: '{{DLVtransaction_id}}'
  });
</script>
<script>
  tlq('set', 'ContactInfo', {
    target: '{{Tracklution ID 2}}',
    email: '{{DLVemail}}',
    phoneNumber: '{{DLVphone}}'
  });
</script>

A: Yes, using the cHTML method, both the original and duplicated tracking script can sit in the same tag if you prefer. Be aware that this limits your conditioning logic if you for example would want to use different consent modes for your Tracklution containers.

Summary

  • Create your second Tracklution container and note its ID.
  • Create a copy of each GTM tag you want to use to collect events and data with both containers.
  • Add the target parameter with the second Tracklution ID.

This setup ensures both Tracklution containers receive the same data at the same time. The same procedure could be performed multiple times to add more Tracklution containers.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied