Skip to content

Google Tag Manager

Target audience: Stakeholders

Introduction

This document describes how to integrate Google Tag Manager and use the dataLayer distributed from PayWay. For more information about Google Tag manager you can read it on Tag manager dev pages.

Workflow

The container är is created and published by Adeprimo, this is for security reasons. Though it is possible to share editing rights to an own account, all changes are reported to Adeprimo and after a control it will be published.

When the container is created we will add one variable that is very important, general.pageUrl. This variable is named ADP-Virtual url and is used to give specifik product urls and also to remove unnecessary parameters from the url.

ADP-Virtual url in Google Tag Manager

If you use Google Analytics it can be added under "More setting" -> "Fields." Add Field Name page and value as shown on the image below. (Print screen in Swedish | "Fler inställningar" = More settings | and | "Fält att ange" = Fields |) Screenshot

If its used in a custom tag it could be used within the code:

1
2
3
4
5
6
7
8
9
pageUrl = {{ADP-Virtuell url}};


//Another example

function() {
  var ext = {{element}}.pathname.split("."); // A variable used as part of a custom script
  return ext.length > 1?ext.pop():'html';
} 

Payway - dataLayer

The dataLayer with variables that can be used in Google Tag Manager are specified below

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
dataLayer = [
{
  "general": {
    "pageName": "V2_SHOP_CONFIRMATION",
    "pageUrl": "/v2/shop/confirmation",
    "pageCategory": "shop",
    "accountOrigin": "N/A",
    "organisation": "mittmedia",
    "returnUrl": "http://yoursite.com"
  },
  "product": {
    "productCode": "st_digital",
    "productName": "ST Digital",
    "isCampaign": false,
    "tags": [
        "Digital"
    ],
    "title": "ST"
  },
  "account": {
    "accountId": "568fb124400e063d22000001",
    "zipCode": null,
    "city": null,
    "age": "",
    "gender": ""
  },
  "order": {
    "orderId": "MITTMEDIA-497",
    "price": 596.0,
    "paymentMethod": "invoice",
    "subscriptionType": "recurring",
    "trafficSource": "",
    "status: "created/closed"
  }
}];
The general parent is visible through the whole portal, product when possible, like the purchase flow.

Note: Account and order are only visible on the "Thank You Page" as they contain sensitive data and data that only exists after a purchase. Though trafficSources also exists on the first page.

Flow Chart - Conversion tracking

(Work in progress)

Cross-Domain - Tracking

For further information about Cross-Domain tracking we advice you to read this guide. If you need help with the setup please contact sanjin.coralic@adeprimo.se

Custom implementation

Are you missing something or want to discuss a custom implementation, feel free to contact us for further discussion.