Insights

How to implement event tracking for airModules

Table of Contents

Guide for Custom Data Layer + Event Tracking

Customers can implement their own custom data layers and events using any tag manager and reference the fields in the standard dataLayers made available by our products using JavaScript.

There are two data layers:

  • airTRFX dataLayer
  • airModules dataLayer

For airModules embedded in iframes, the EM.context can be utilized to create custom data layers and trigger events.

In this guide:

airTRFX dataLayer

The airTRFX dataLayer includes page information on every airTRFX page.

  • Airlines: 
  • Hospitality: 

How to find the EM dataLayer

Type EM.dataLayer in the Console on any airTRFX page:

EM.dataLayer image

The variable values within the EM.dataLayer will vary based on the airTRFX page viewed. These variables are dynamically populated to ensure the data corresponds to the page currently being accessed.

airModules dataLayer

The airModules dataLayer is a data structure that gets updated with every viewable impression and module interaction. This means that each airModule will fire a dataLayer with relevant information to the interaction in an event format.

Events included in the airModules dataLayer

Review the types of events being tracked for each airModule in the developer documentation as the list is every growing with new products and features released all the time.

How to find the airModules dataLayer

1. Interact with any airModule

airModules datalayer image

2. Open developer tools and type dataLayer in Console on any airTRFX Page

airModules datalayer image

3. Every dataLayer will be displayed. The airModules dataLayer scripts have an event format.

airModules datalayer image

4. (Optional) To check FSI events dataLayer

FSI events will redirect the user to the Internet Booking Engine making it harder to see the FSI dataLayer. So, in addition to the steps above, before doing the FSI, run this in the console:

window.onbeforeunload = function (e) { e = e || window.event; return ''; }

That’ll prompt a popup to appear asking if you want to change pages. Just click “Cancel” and you should be able to see the details.

EM.context

All the available parameters of the EM.context can be found in the following link: https://github.com/EveryMundo/emDataStandards/blob/master/dataLayer/EM.context.json

How to find the EM.context

1. Go to the URL where the iframed module is placed and open ‘Console’ from Google Developer Tools.

Finding EM.context image

2. In ‘Console’ access the iFrame using the ‘JavaScript context’:

Finding EM.context image

3. Once the iFrame has been accessed, type ‘EM.context’:

Finding EM.context Image

Implementing Event Tracking in GTM

Event tracking has to be done through a TMS. In this example, we will use GTM and GA4 implementation. GTM is the most used TMS in the airline industry and GA4 is the newest version of Google Analytics.

1. Create a ‘Custom Event’ trigger

Create a ‘Custom Event’ trigger

Once the ‘Custom Event’ trigger type is selected, type the name of the event in the ‘Event name’ field. For this example, we will use the ‘fsi’ event. The trigger must fire in all custom events.

Event Tracking Image

2. Create a GA4 event tag

Event Tracking Image

  • Select your GA4 Configuration Tag and name it ‘fsi’

Event Tracking Image

  • Finally, add the ‘fsi’ trigger to the tag

Event Tracking Image

3. (Optional) Add the airModules dataLayer’s variables to the ‘Event Parameters’ list as dataLayer variables to implement custom dimensions in your GA4 account

Event Tacking image

  • Create a ‘Custom JavaScript’ Variable

The naming convention of the variables in GTM can be defined by the Analytics Manager but we recommend the following naming convention:

EM dataLayer – {{section}} – {{variable}}

Example: EM dataLayer – page – typeName

The intention of this naming convention is to have order in GTM and avoid confusion when using the variables across tags.

  • Select ‘Custom JavaScript’ as variable type

Event Tracking Image

  • Insert JavaScript Function

Insert the following function in the empty space (in this example we will target the pageType variable):

function(){return EM.dataLayer[0].page.typeName;}

Event Tracking Image 3

  • Add the Custom Javascript variables as parameter values to the custom event

Browser Extension to Review the Custom Data Layer

Adswerve – dataLayer Inspector+ (google.com)

Analyze your events in GA4

Access your GA4 account and go to Reports > Engagement > Events

GA4 Events

Select the ‘fsi’ event to analyze the data collection

‘fsi’ event

(Optional) If ‘Event Paramters’ were added to the tag in GTM the Custom Dimensions will have to be set up in GA4 as well. To do this go to Configure > Custom Dimensions. In this section click on ‘Create custom dimension’ and name the parameter you wish to start tracking.

GA4 Custom Dimensions

Analyze Events Image 3.1

Creating a new dataLayer object using the EM.dataLayer

For this example, we will use the EM.dataLayer to populate Tealium’s utag_data object.

1. Identify the parameters needed in the script

The parameters that will use JavaScript will be those that need dynamic values. For example:


<script>
var utag_data = {
device_category: "",
site_edition: "",
site_language: "",
site_market: ""
};
</script>

2. Use JavaScript to map the parameters from the EM.dataLayer

The variables in the EM.dataLayer can be accessed using JavaScript paths:

variables in the EM.dataLayer

Data Element EM.dataLayer JavaScript EM.context JavaScript
device_category EM.dataLayer[0].device.category EM.context.audience.device_category
site_edition EM.dataLayer[0].page.siteEdition EM.context.geo.language.site_edition
site_language EM.dataLayer[0].page.languageIsoCode EM.context.geo.language.lang
site_market EM.dataLayer[0].page.countryIsoCode EM.context.geo.language.siteEditionMarket

3. Insert the JavaScript paths to the TMS dataLayer object

Add the JavaScript paths to the corresponding variables:


<script>
var utag_data = {
device_category: EM.dataLayer[0].device.category,
site_edition: EM.dataLayer[0].page.siteEdition,
site_language: EM.dataLayer[0].page.languageIsoCode,
site_market: EM.dataLayer[0].page.countryIsoCode
};
</script>

TMS Tag Example

In GTM, the dataLayer script will be added to a Custom HTML tag. The tag should look like this:

dataLayer script added to Custom HTML Tag

Other content in this Stream

PROS Revenue Management Certification

Product Solution Information

PROS Integration Guide: How to Integrate Data & Systems in PROS Platform

Unlock the power of adaptability in business with our PDF guide. Learn why integrating or extending the PROS Platform is paramount today.

Product Solution Information

PROS Enterprise AI for the Chemicals Industry

Learn how AI-powered pricing and selling solutions can lead chemicals companies toward profitable growth.

Artificial IntelligenceDigital Business TransformationProduct Solution Information

Optimizing Shopping and Selling Experiences with The PROS Platform for Distribution

See how the PROS Platform helps businesses in the distribution industry make every buying experience more personalized and ever transaction more profitable.

Product Solution Information

PROS Enterprise AI for the Food Industry

Download this food and consumables guide to learn: Strategies for navigating market complexity, benefits of dynamic pricing, and how streamlined end-to-end selling processes can help your organization

Product Solution Information

PROS Cloud for Travel: Secure Cloud Solutions Airlines Can Rely On

Finding a solution that provides security, cost efficiency, and winning functionality can be a daunting task. PROS Cloud applications provide capabilities to help you achieve your business goals.

Product Solution Information