The global site tag allows you to use one common tag on your site to implement various Google products including Google Flights conversions, Google Flights price accuracy, Google Analytics, Google Ads remarketing, Google Ads conversions, or similar.
Reporting for Google Flights is composed of 2 tags:
- The Google Flights Price Accuracy Tag helps measure the price accuracy of your Google Flights booking links.
- The Google Flights Conversion Tag helps measure conversions from clicks on Google Flights links.
Keep in mind
The global site tag will create a new first party cookie on your domain. By default this cookie is named _gcl_gf
. This cookie stores data about the click on Google Flights that referred the user to your site. This data is used by your Google Flights reporting tags. In order to pass data to the _gcl_gf
cookie, Google Flights injects two query string parameters (gclsrc
, gclid
) into the referral URL. Make sure these query string parameters are allowed and passed through any redirects to the landing page.
Keep in mind
To help ensure accurate reporting, add Google Flights reporting tags to all variations of your site:
- All platform versions, both desktop and mobile
- All country-specific and language-specific versions
Instructions
Add the global site tag
- Make sure that you have your Google Flights partner ID ready. If you have not received your unique partner identifier, please file a request and select the “Partner ID Request” option. Please include the email of your Google Flights contacts in the “Additional email addresses to include in communication” section.
- Place the global site tag snippet as the first item in the
<HEAD>
section on every page of your site. ReplacePARTNER_ID
with your unique partner identifier. For example, if yourPARTNER_ID
is 233, replaceGF-PARTNER_ID
withGF-233
.- Note: You only need one global site tag per page. If you previously installed a global site tag for a different Google product, you can keep the tag and just add
gtag('config', 'GF-PARTNER_ID')
after your existing gtag.js config line for your existing Google products. For an example of using gtag.js with other Google products, see How to adapt an existing global site tag for your Google Ads account.
<!-- Global site tag (gtag.js) - Google Flights: PARTNER_ID -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GF-PARTNER_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());gtag('config','GF-PARTNER_ID');
</script> - Note: You only need one global site tag per page. If you previously installed a global site tag for a different Google product, you can keep the tag and just add
Add the Google Flights Price Accuracy Tag
- Install a view_item event snippet on your deep link landing page. Put this tag as the second item in the
<HEAD>
on the deep link landing page. Below is a list of parameters that we expect in the event.
If the itinerary is available:send_to
: Partner ID to send event data to. Using the example above, if yourPARTNER_ID
is 233, replaceGF-PARTNER_ID
withGF-233
.value
: Total price of the flight as a string.- Note: Values should be formatted as decimal numbers using a period character "." as the decimal separator. Commas may be included in the string, but they will be ignored. Example valid values: "123456.789", "123,456.789".
-
currency
: Currency (ISO 4217 format) the conversion value is measured in (for example, USD).
Here is a sampleview_item
event.
Note: ReplacePARTNER_ID
with your unique partner identifier.<!-- Event snippet for deep link landing page -->
<script>
gtag('event', view_item, {
'send_to': 'GF-PARTNER_ID’,
'value': '248.30',
'currency': 'USD'
});
</script>If the itinerary is not available:
-
send_to:
Partner ID to send event data to. Using the example above, if yourPARTNER_ID
is 233, replaceGF-PARTNER_ID
withGF-233
. flight_error_code
: One of these string values:
“FLIGHT_NOT_FOUND”
“TIMEOUT”
“GEO_BLOCKED”
“OTHER”
-
flight_error_message
: a free text field where you can add non-PII data that will be shared back via the Travel Analytics Center. - Here is a sample
view_item
event.
Note: ReplacePARTNER_ID
with your unique partner identifier.<!-- Event snippet for deep link landing page -->
<script>
gtag('event', view_item, {
'send_to': 'GF-PARTNER_ID',
'flight_error_code': 'FLIGHT_NOT_FOUND',
'flight_error_message': 'An optional reason'
});
</script>
- Verify the price data using "Developer tools" in Google Chrome.
- Press Ctrl + Shift + i (PC) or Cmd + Shift + i on your keyboard to open "Developer tools".
- Select the Network tab.
- Navigate to your deep link landing page that fires the view_item event. Look for entry with Name prefix “?price=”. You should see a GET request to www.googletraveladservices.com. You can then inspect the actual values sent through in the price query string parameter.
- Once the tag is deployed, contact the Google Flights team to verify the price data.
Add the Google Flights Conversion Tag
-
Install a purchase event snippet on the conversion page. Put this tag as the second item in the <HEAD> on the conversion page. Below is a list of parameters that we expect in the event.
send_to
: Partner ID to send event data to.. Using the example below, if yourPARTNER_ID
is 233, replaceGF-PARTNER_ID
withGF-233
.value
: Total price of the conversion as a string.
Note: Values should be formatted as decimal numbers using a period character "." as the decimal separator. A comma can't be used as a decimal separator. Commas may be included in the string, but they'll be ignored. Example valid values: "123456.789", "123,456.789".currency
: Currency (ISO 4217 format) the conversion value is measured in (e.g. USD).trip_type
: Itinerary type determined by the routing. Value must be one of “OneWay”, “RoundTrip” or “Other”.passengers.total
: Number of passengers in the booking.passengers.adult
: Number of booked adult or senior passengers.passengers.child
: Number of booked child passengers.passengers.infant_in_seat
: Number of booked passengers in infant seats.passengers.infant_in_lap
: Number of booked passengers with infant in lap seating.items
: The Items field is sent as a JavaScript array. Each item in the array represents a flight segment. Each item includes:travel_class
: The cabin that the customer purchased. Value must be one of “Economy”, “PremiumEconomy”, “Business”, or “First”.fare_product
: The fare product, also known as brand, associated with the flight segment (for example, “Basic Economy”, “Premium Flex”, “Economy Saver” etc).booking_code
: The 1-letter booking code associated with the flight segment (for example, "Y" for economy, "F" for first).flight_number
: Flight number, formatted as ZZ123 where ZZ is the 2-letter marketing carrier.origin
: 3-letter origin airport IATA code.destination
: 3-letter destination airport IATA code.start_date
: flight departure date in ISO 8601 format (“yyyy-MM-dd”).
Here is a sample conversion event:<!-- Event snippet for conversion page -->
<script>
gtag('event', 'purchase', {
'send_to': 'GF-233',
'trip_type': 'Other',
'value': '248.30',
'currency': 'USD',
'passengers': {
'total': 2,
'adult': 2,
'child': 0,
'infant_in_seat': 0,
'infant_in_lap': 0
},
'items': [
{
'travel_class': 'Economy',
'fare_product': 'Basic Economy',
'booking_code': 'U',
'flight_number': 'AB123',
'origin': 'BOS',
'destination': 'ZRH',
'start_date': '2020-04-17',
}, {
'travel_class': 'PremiumEconomy',
'fare_product': 'Economy',
'booking_code': 'U',
'flight_number': 'AB234',
'origin': 'ZRH',
'destination': 'LHR',
'start_date': '2020-04-21',
}]
});
</script>
- Verify the conversion data using "Developer tools" in Google Chrome.
- Press Ctrl + Shift + i (PC) or Cmd + Shift + i on your keyboard to open "Developer tools".
- Select the Network tab.
- Run the final booking step to get to the conversion page that fires the purchase event. Look for entry with Name prefix “?conversion_data=”. You should see a GET request to www.googletraveladservices.com. You can then inspect the actual values sent through in the conversion_data query string parameters.
-
Contact the Google Flights team to verify the conversions once the tag is deployed.