Deduplication with GTM

A guide to implement Criteo Deduplication solution in GTM.

Overview

Deduplication is a parameter added to the Criteo Sales tag, which enables our system to identify whether that transaction was attributed to Criteo or not. It is typically implemented with a last-click attribution model. The idea is quite simple: if the user goes to the website through a Criteo banner, and ultimately purchases a product (or any other act considered as a sale metric), the sale will be attributed to Criteo (dedup = 1), otherwise not (dedup = 0). Such a value will persist for a given time – usually 30 days, unless the user clicks on a banner from other campaign (Google, Yahoo etc).

In order to set it up in Google Tag Manager, we will need 2 Variables, 2 Triggers and 1 Tag.

[[disclaimer-developer]]

Steps

  1. Open GTM and create a Tag, called Criteo Dedupe Cookie:

    <script>
        var date = new Date(); //current date to create the cookie
        var expires; //expire date of the cookie
        var value; //cookie's value
        var url = {{Page URL}}; //current page URL
        date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000));
        expires = date.toUTCString();
        value = url.search("utm_source=criteo") != -
            1 ? "criteo" : "other";
        document.cookie = "__utmz=" + value + "; expires=" +
            expires + "; path=/";
    </script>
    

    1

  2. Create 2 Triggers for that tag: criteoDedupe & otherDedupe 2 3
  3. Add the 2 Triggers to the Criteo Dedupe Cookie 4
  4. Create a Variable called utmz: 5
  5. Create a Variable called isCriteo:

    function() {
        var cookie = {{utmz}};
        if (cookie == undefined) {
            cookie = 'other';
        }
        return (cookie.search('criteo') != -1 ? 1 : 0);
    }
    

    6

  6. Add the isCriteo Variable to the Criteo Sales tag: 7

Verification

[[accurate]]