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 In the new IBE we have added an ecomm_event to the confirmation page data layer, now it would look like this:
dataLayer = [{ // Array selected_flights: [ flight_num: ' ', flight_date: ' ', from: ' '; to: ' ', price: ' ' ], crtid: ' ', pnrref: ' ', customer_email: ' ', totalprice: ' ',
currency: ' ',
event: confirmation },
/*Valid only for new IBE*/
{
"transactionId": "", /*PNR*/
"event": "ecomm_event",
"transactionAffiliation": "", /*Airline name / Agency name*/
"transactionTotal": , /*PNR Total in currency*/
"transactionProducts": [
//Flight
{
"sku": "", /*Flight number-uniqueid*/
"name": "Flight",
"category": "", /*Class name - I.E - Economy*/
"price": "", /*Price of service*/
"quantity": 1
},
//Ancillary
{
"sku": "", /*Extra Service - For instance - Baggage-uniqueid*/
"name": "", /*Ancillary name - For instance, Extra Baggage*/
"category": "", /*Extra Service - For instance - Baggage*/
"price": "", /*Price of service*/
"quantity": 1
},
//Seats
{
"sku": "", /*Seat number-uniqueid*/
"name": "Seat",
"category": "Extras",
"price": "", /*Price of seat*/
"quantity": 1
}
];
Addition - 23/05/19
To use the ecomm_event - follow this guide
Valid only for the new IBE.
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.
- 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:
- Now that we have created all of the above, we will need to create a trigger for this event:
- 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.
Comments