The implementation of the Yieldr tag can be done in seven simple steps using Google Tag Manager (GTM). More information on our tag and the type of data it collects can be found here.

1. First, you’ll need to apply a single script that includes your API key (see email). To accomplish this simply:

a. Copy the script from the tag section of the project you created in the Yieldr Platform or from the email you received.
b. Create a new custom tag in Google Tag Manager.
c. Paste the code into the newly created GTM tag.

For example, "Fly Yieldr" has API key "12345678". The corresponding base tag that should be loading on all pages would look like this:

<!-- Begin Yieldr Analytics: "Fly Yieldr" --> 
<script type="text/javascript">
!function(y,i,e,l,d,r){if(y.YieldrAsyncQueue=l,y[l]=y[l]||[],!y[l].loaded){y[l].loaded=!0,d=["init","track","sync"],r=function(n){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(n),y[l].push(t)}};for(var n=0;n<d.length;n++)y[l][d[n]]=r(d[n]);var t=i.createElement("script");t.async=!0,t.src="//cdn.yldr.io/yldr.v0.min.js",i.getElementsByTagName("body")[0].appendChild(t),y[l].version="0.5.0"}}(window,document,0,"_yldr");
_yldr.init("12345678");
</script>
<!-- End Yieldr Analytics -->

2. It’s imperative that this tag loads before the event tags, which we will implement in the following steps. To ensure this, select advanced options underneath the HTML box to configure the tag firing priority. Tags with higher numbers for priority will be fired first. We suggest inputting an integer of 5 or higher. 

3. In order to accurately track events, you’ll need to implement five more tags in GTM for each of the five stages of the user funnel*. The data that is being passed through depends on the funnel stage and the available data on the page, which you can learn more about here. The first step is the homepage. You can paste in the following script:

<script type="text/javascript">
  _yldr.track("page_view", {
    "language": {{Language}}, // e.g. en or es
    "funnel_stage": "1"
  });
</script>

4. For the next four funnel stages, there will be more information available, therefore you’ll need to add your own macros to the Javascript so that data is passed through to the tag dynamically. The second stage of the user funnel is the flight selection page, which could include information such as flight origin and destination. The script of the page could look something like this:

<script type="text/javascript">
  _yldr.track("page_view", {
    "language": {{Language}}, // e.g en or es
    "flight_origin": {{Origin IATA Code}}, //e.g AMS
    "flight_destination": {{Destination IATA Code}},//e.g BCN
    "flight_departure_date": {{Departure Date}}, //2017-12-31T00:00:00+00:00
    "flight_return_date": {{Return Date}}, // 2018-01-01T00:00:00+00:00
    "flight_type": {{Flight Type}}, // e.g. business or leisure
    "flight_adults": {{PAX Adults}}, // e.g. 2
    "flight_children": {{PAX Children}}, // e.g. 1
    "flight_infants": {{PAX Infants}}, // e.g. 1
    "user_customer_id": {{Customer ID}}, // e.g. 11223344
    "user_first_name": {{First Name}}, // e.g. Jane
    "user_last_name": {{Last Name}}, // e.g. Doe
    "user_birth_date": {{Date of Birth}}, // e.g. 2000-01-01
    "user_age": {{Age}}, // e.g. 18
    "user_postal_code": {{Postal Code}}, // e.g 1000 AJ
    "user_address": {{Address}}, // e.g. Stadhouderskade 85
    "user_city": {{User City}}, // e.g. Amsterdam
    "user_country": {{User Country}}, e.g. NLD
    "user_gender": {{Gender}}, // e.g. Female
    "user_email": {{E-Mail Address}}, // e.g. jane.doe@yieldr.com
    "user_phone_number": {{Phone Number}}, // e.g. +31612345678
    "user_loyalty_program": {{Loyalty Program}, // e.g. Yieldr Green
    "funnel_stage": "2"
   });
</script>

5. The third stage of the user funnel is the passenger information page. At this point a traveler has already select a flight so the script could include information such as flight number, flight class and flight value. Also the page usually includes an e-mail address and phone number which can be used for email or sms activation later on. An example of the Javascript could look like this:

<script type="text/javascript">
  _yldr.track("page_view", {
    "language": {{Language}}, // e.g. en or es
    "flight_carrier": {{Flight Carrier}}, // e.g. YY
    "flight_origin": {{Origin IATA Code}}, //e.g. AMS
    "flight_destination": {{Destination IATA Code}},//e.g. BCN
    "flight_departure_date": {{Departure Date}}, //2017-12-31T11:30:00+00:00
    "flight_return_date": {{Return Date}}, // 2018-01-01T09:20:00+00:00
    "flight_number": {{Flight Number}}, // e.g. YY1234
    "flight_type": {{Flight Type}}, // business or leisure
    "flight_class": {{Flight Class}}, // First, Business, Economy or Premium economy
    "flight_class_code": {{Flight Fare Basis Code}}, // F, J, Y or W
    "flight_adults": {{PAX Adults}}, // e.g. 2
    "flight_children": {{PAX Children}}, // e.g. 1
    "flight_infants": {{PAX Infants}}, // e.g. 1
    "flight_value": {{Flight Value}}, // e.g. 1234.67
    "flight_currency": {{Currency}}, // e.g. EUR or USD
    "user_customer_id": {{Customer ID}}, // e.g. 11223344
    "user_first_name": {{First Name}}, // e.g. Jane
    "user_last_name": {{Last Name}}, // e.g. Doe
    "user_birth_date": {{Date of Birth}}, // e.g. 2000-01-01
    "user_age": {{Age}}, // e.g. 18
    "user_postal_code": {{Postal Code}}, // e.g. 1000 AJ
    "user_address": {{Address}}, // e.g. Stadhouderskade 85
    "user_city": {{User City}}, // e.g. Amsterdam
    "user_country": {{User Country}}, e.g. NLD
    "user_gender": {{Gender}}, // e.g. Female
    "user_email": {{E-Mail Address}}, // e.g. jane.doe@yieldr.com
    "user_phone_number": {{Phone Number}}, // e.g. +31612345678,
    "user_loyalty_program": {{Loyalty Program}, // e.g. Yieldr Green
    "funnel_stage": "3"
  });
</script>

6. The fourth stage of the funnel is the payment page. Here you could find information such as ancillaries or taxes. Below is an example of the Javascript. Again, remember to apply your own macros here.

<script type="text/javascript">
  _yldr.track("page_view", {
    "language": {{Language}}, // e.g. en or es
    "flight_carrier": {{Flight Carrier}}, // e.g. YY
    "flight_origin": {{Origin IATA Code}}, // e.g. AMS
    "flight_destination": {{Destination IATA Code}},// e.g. BCN
    "flight_departure_date": {{Departure Date}}, // e.g. 2017-12-31T11:30:00+00:00
    "flight_return_date": {{Return Date}}, // e.g. 2018-01-01T09:20:00+00:00
    "flight_number": {{Flight Number}}, // e.g. YY1234
    "flight_type": {{Flight Type}}, // e.g. business or leisure
    "flight_class": {{Flight Class}}, // e.g. First, Business, Economy or Premium economy
    "flight_class_code": {{Flight Fare Basis Code}}, // e.g. F, J, Y or W
    "flight_adults": {{PAX Adults}}, // e.g. 2
    "flight_children": {{PAX Children}}, // e.g. 1
    "flight_infants": {{PAX Infants}}, // e.g. 1
    "flight_value": {{Flight Value}}, // e.g. 1234.67
    "flight_currency": {{Currency}}, // e.g. EUR or USD
    "flight_pnr": {{PNR}}, // e.g. Y1E7DR
    "flight_ancillary_value": {{Ancillaries}}, // e.g. 165.33
    "tax_value": {{Taxes}}, // e.g. 200.00
    "total_value": {{Total Value}}, // e.g. 1600.00
    "user_customer_id": {{Customer ID}}, // e.g. 11223344
    "user_first_name": {{First Name}}, // e.g. Jane
    "user_last_name": {{Last Name}}, // e.g. Doe
    "user_birth_date": {{Date of Birth}}, // e.g. 2000-01-01
    "user_age": {{Age}}, // e.g. 18
    "user_postal_code": {{Postal Code}}, // e.g. 1000 AJ  
    "user_address": {{Address}}, // e.g. Stadhouderskade 85
    "user_city": {{User City}}, // e.g. Amsterdam
    "user_country": {{User Country}}, e.g. NLD
    "user_gender": {{Gender}}, // e.g. Female
    "user_email": {{E-Mail Address}}, // e.g. jane.doe@yieldr.com
    "user_phone_number": {{Phone Number}}, // e.g. +31612345678
    "user_loyalty_program": {{Loyalty Program}, // e.g. Yieldr Green
    "funnel_stage": "4"
  });
</script>

7. The last step is to add the fifth and final step of the funnel - the sale. Even if you have events following the sale in your own funnel, it must be defined as the fifth stage here. The resulting script could look something like this:

  <script type="text/javascript">
  _yldr.track("page_view", {
    "language": {{Language}}, // e.g. en or es
    "flight_carrier": {{Flight Carrier}}, // e.g. YY
    "flight_origin": {{Origin IATA Code}}, // e.g. AMS
    "flight_destination": {{Destination IATA Code}},// e.g. BCN
    "flight_departure_date": {{Departure Date}}, // e.g. 2017-12-31T11:30:00+00:00
    "flight_return_date": {{Return Date}}, // e.g. 2018-01-01T09:20:00+00:00
    "flight_number": {{Flight Number}}, // e.g. YY1234
    "flight_type": {{Flight Type}}, // e.g. business or leisure
    "flight_class": {{Flight Class}}, // e.g. First, Business, Economy or Premium economy
    "flight_class_code": {{Flight Fare Basis Code}}, // e.g. J, Y or W
    "flight_adults": {{PAX Adults}}, // e.g. 2
    "flight_children": {{PAX Children}}, // e.g. 1
    "flight_infants": {{PAX Infants}}, // e.g. 1
    "flight_value": {{Flight Value}}, // e.g. 1234.67
    "flight_currency": {{Currency}}, // e.g. EUR or USD
    "flight_pnr": {{PNR}}, // e.g. Y1E7DR
    "flight_ancillary_value": {{Ancillaries}}, // e.g. 165.33
    "tax_value": {{Taxes}}, // e.g. 200.00
    "total_value": {{Total Value}}, // e.g. 1600.00
    "user_customer_id": {{Customer ID}}, // e.g. 11223344
    "user_first_name": {{First Name}}, // e.g. Jane
    "user_last_name": {{Last Name}}, // e.g. Doe
    "user_birth_date": {{Date of Birth}}, // e.g. 2000-01-01
    "user_age": {{Age}}, // e.g. 18
    "user_postal_code": {{Postal Code}}, // e.g. 1000 AJ  
    "user_address": {{Address}}, // e.g. Stadhouderskade 85
    "user_city": {{User City}}, // e.g. Amsterdam
    "user_country": {{User Country}}, e.g. NLD
    "user_gender": {{Gender}}, // e.g. Female
    "user_email": {{E-Mail Address}}, // e.g. jane.doe@yieldr.com
    "user_phone_number": {{Phone Number}}, // e.g. +31612345678
    "user_loyalty_program": {{Loyalty Program}, // e.g. Yieldr Green
    "funnel_stage": "5"
  });
</script>

Once you’ve successfully implemented these six tags, you’ll be able to start collecting data and be well on your way to making every flight more profitable.

*Note: Even if your funnel contains more than 5 funnel stages, all stages should have a number between 1 and 5 to correspond to the Yieldr Platform. 1 is always defined as the page before a flight search/selection (homepage or promotional page) and 5 is always defined as the actual sale. For example, when your funnel has an extras or ancillaries page between the passenger (funnel stage 3) and payment pages (funnel stage 4), the funnel stage should be 3. When you’re "between" funnel stages, you should always round down to the nearest defined funnel stage.

Available Parameters

Below is a list with all available parameters. Please note that all dates should be formatted using the ISO 8601 standard. Date formatting can be achieved in JavaScript using Date.prototype.toISOString().

Also see:


Yieldr Tag Testing

User Consent

Did this answer your question?