Google Data Layers variables

In this article, we will explain the "Google Data Layers" optional variables which exist in some pages in the website for Google experts to use:

/* Search Result: */
dataLayer = [{
    crtid: ' ',
    from: ' ',
    to: ' ',
    triptype: 'RT/OW',
    adults: ' ',
    kids: ' ',
    infants: ' ',
    result: true/false,
    // Arrays
    outbound: [
        class: ' ',
        price: ' ',
        from: ' ',
        to: ' '
    ],
    inbound: [
        class: ' ',
        price: ' ',
        from: ' ',
        to: ' '
    ]
}];

/* Itinerary */
dataLayer = [{
    crtid: ' ',
    from: ' ',
    to: ' ',
    totalprice: ' ',
    ancillaries: true/false,
    triptype: 'RT/OW',
    adults: ' ',
    kids: ' ',
    infants: ' ',
    // Array
    selected_flights: [
        flight_num: ' ',
        from: ' ';
        to: ' ',
        price: ' '
    ]
}];

/* Confirmation */
The total price is always on the default currency of the company, and the currency is the name of the default currency of the company dataLayer = [{ // Array selected_flights: [ flight_num: ' ', flight_date: ' ', from: ' '; to: ' ', price: ' ' ], crtid: ' ', pnrref: ' ', customer_email: ' ', totalprice: ' ',
currency: ' ',
event: confirmation }];

 

Example on how to use the GTM and Google Analytics:

Let's say we wish to know every time a purchase was made, and how much was paid. As explained earlier, the totalprice will always be in the company default currency.

  1. We will create variables in GTM for the data layer variables in order to extract them, let's say that we need the transaction id, and how much was paid:  After we have these, we will also need global settings for Google Analytics:  The last thing we will need is to make a tag for the confirmation event in the data layer: 
  2. Now that we have created all of the above, we will need to create a trigger for this event: 
  3. Now that we have the triggers and variables, lastly we will need to make a tag for the Google Analytics that will be in effect every time this event triggers: 

 

That's it! Now every time your website customer reaches the Confirmation page on the website, an event will be triggered and sent to your Google Analytics account. How it looks:

And in google analytics:

 

If you have other inquires please do not hesitate to ask or open a support ticket.

Have more questions? Submit a request

Comments

Powered by Zendesk