GTM integrationEN

From Wiki

Jump to: navigation, search

Contents

[-] Google Tag Manager - Template Integration

Google Tag Manager - Template Integration

Step 1 - Installing the Journey Tag

The Awin Journey Tag is a JavaScript library that contains all the necessary functions for the Awin tracking to work as expected.

1) Navigate to "Tags"


2) Click “New” and choose the ‘Awin Journey’ tag.

4) Enter your advertiser ID provided by your Integrator

5) Select "All Pages" as the trigger

6) Name and save this tag appropriately

Step 2 - Automatic de-duplication and the Channel Parameter

This allows Awin’s conversion tag to identify which was the last paid media to generate the last click in the user’s journey before the checkout, this way, Awin’s platform can determine which transactions came from Awin and which didn’t, thus having an automatic de-duplication performed.

1) Create a new variable and name it “Awin - ChannelCookie”, this should be a First Party cookie variable:

2) Name the cookie this way “AwinChannelCookie”:

3) Navigate to the "Tags" tab, and create a new Custom HTML tag:

4) Paste the following tag:

<script>
var iCookieLength = 30; // Cookie length in days
var sCookieName = "AwinCookie"; // Name of the first party cookie to utilise for last click referrer de-duplication
var sSourceParameterName = ["utm_source", "gclid", "fbclid"]; // The parameter used by networks and other marketing channels to tell you who drove the traffic
var _getQueryStringValue = function (sParameterName) {
                var aQueryStringPairs = document.location.search.substring(1).split("&");
                for (var i = 0; i < aQueryStringPairs.length; i++) {
                                var aQueryStringParts = aQueryStringPairs[i].split("=");
                                if (sParameterName.includes(aQueryStringParts[0].toLowerCase())) {
                                                if(aQueryStringParts[1]=="awin"){
                                                                return 'aw';
                                                }
                                                else{
                                                                return 'na';
                                                }
                                }
                }
};
 
var _setCookie = function (sCookieName, sCookieContents, iCookieLength) {
                var dCookieExpires = new Date();
                dCookieExpires.setTime(dCookieExpires.getTime() + (iCookieLength * 24 * 60 * 60 * 1000));
                document.cookie = sCookieName + "=" + sCookieContents + "; expires=" + dCookieExpires.toGMTString() + "; path=/;";
};
 
if (_getQueryStringValue(sSourceParameterName)) {
                _setCookie(sCookieName, _getQueryStringValue(sSourceParameterName), iCookieLength);
}
if (document.cookie.indexOf("AwinCookie=") < 0){
    _setCookie(sCookieName, "aw", iCookieLength);
}
</script>

5)Assign an All Pages trigger to the tag.

Step 3: Define the Awin sale tracking

1) Create a new Awin Tag and select the ‘Awin Conversion’ Tag.

2) Defining you DataLayer values, in case you don't know how to map DataLayer variables, here is a guide you can follow on How to map DataLayer variables in GTM

3) Select the trigger that fires once a conversion or the desired event occurs. (The "success" page for conversions, or an confirmation event for leads).

4) Click ‘Save’ and you will then be asked to rename the Tag but you can leave it as it is.

5) Click ‘save’ and you should now have two Tags listed in the Tags table.

Step 4 - Product Level Tracking (PLT)


This step should only be followed by e-commerces, if you do not have an e-commerce, please ignore this step.

Product Level Tracking allows the advertiser to generate much detailed deports, it shows the performance for each product in the shopping cart individually, this is specially relevant for e-commerces.

1) Download the Awin - Product Level Tracking template here.

2) Navigate to the "Templates" tab, and create a new template:

3) Click on the menu icon located at the top right corner of the screen, and import an existing template.

4) Select the previously downloaded file GTM_CustomTag_ProductLevelTracking.tpl, and hit "Save".

5) Create a new tag, and select the previously created template.

6) Setup the tag's variables with the correct information. If your products array does not use the default property values (“id”, “name”, “quantity”, “price”, “category” or “sku”), enable the "Override Default Product Properties" checkbox and inform the correct values.

7) Use the same trigger as the Awin Conversion Tag.

Step 5 - Tests

1) All done! Now just publish the changes!

2) You can follow this guide on How to Test the Awin Tags or contact your Integrator for further assistance!

Privacy

Due to new European legislation regarding how websites store information about you, AWIN is updating its privacy policy. You can see the new version of our policy here. If you would like to see the information we capture on this website, please click here for further details. In order to accept cookies on this site please click the 'I ACCEPT' button