Pre-Conversion Pixel Tracking
Pre-Conversion tracking
In order to optimize the experience and service that Wego provide to our users and partners, Wego implements a tracking pixel to help track the availability and price of itineraries that users get when redirected from Wego to Partner's website.
Process flow steps
- User redirects from Wego to a Partner's website using the deeplink generated through Wego integration.
- Partner's site stores the
wego_click_idfrom the deeplink URL. If you can't findwego_click_id, please contact your account manager. - Partner's site triggers the Pre-Conversion tracking when the Partner's site is loaded.
- This pixel will calls Wego's systems to store the fare availability and price for monitoring and optimization
Pixel implementation
The Pre-Conversion Pixel is served from Wego's secure server (zen.wego.com, srv.wego.com). So it should not produce any security warnings or errors within users' browsers. Implementation process should take no more than 15-20 minutes:
Implementation Options
You can implement the Pixel in 3 different ways:
- JavaScript Pixel Library - Full-featured implementation with automatic data collection for both Pre-Conversion and Conversion tracking
- Image Pixel - Lightweight implementation using HTML
<img>tags - Server to Server (Recommended) - Backend integration where events are sent directly from your server to ensure reliable delivery
1. JavaScript Pixel Library
Add this code snippet to the <head> section of every page where you want to track events:
<!-- Wego Events Pixel -->
<script>
!function(w,e,g,o,n,a,m){
w['WegoEventsObject']=n;w[n]=w[n]||function(){
(w[n].q=w[n].q||[]).push(arguments)},w[n].l=1*new Date();
a=e.createElement(g),m=e.getElementsByTagName(g)[0];
a.async=1;a.src=o;m.parentNode.insertBefore(a,m)
}
(window,document,'script','https://zen.wego.com/partner/js/wegoevents.js','wego');
// Initialize the pixel with conversion_id (required, a unique Partner's identifier in the Wego system)
wego('init', {{CONVERSION_ID}});
</script>
Replace {{CONVERSION_ID}} with your partner's identifier. Please request this id from your Wego account manager if not provided.
When run, this code will download a library of functions which you can then use for pre-conversion tracking. We recommend that you leave this function call intact.
JS Pixel Example
The pixel can be triggered by calling the function in the sample below once the script is initialized.
Note: conversion_id auto-included from init, wego_click_id auto-fetched from URL query param wego_click_id
// for example:
wego('track', 'Landing', {
total_quote_value: {{TOTAL_QUOTE_VALUE}},
quote_currency_code: {{QUOTE_CURRENCY_CODE}},
status: {{STATUS}},
stage: {{STAGE}},
has_upsell: {{HAS_UPSELL}},
has_ancillaries: {{HAS_ANCILLARIES}}
});
In case your handoff links uses a different tracking parameter name for the wego_click_id, you can manually pass the click_id in the function as well:
wego('track', 'Landing', {
click_id: {{WEGO_CLICK_ID}},
total_quote_value: {{TOTAL_QUOTE_VALUE}},
quote_currency_code: {{QUOTE_CURRENCY_CODE}},
status: {{STATUS}},
stage: {{STAGE}},
has_upsell: {{HAS_UPSELL}},
has_ancillaries: {{HAS_ANCILLARIES}}
});
2. Image Pixel Implementation
If you need to install the Pixel using a lightweight implementation, you can install it with an <img> tag. This method is ideal for simple tracking scenarios where you don't need advanced features.
Img Pixel Example
<img src="https://srv.wego.com/analytics/v3/landings/event
?conversion_id={{CONVERSION_ID}}&click_id={{WEGO_CLICK_ID}}
&total_quote_value={{TOTAL_QUOTE_VALUE}}"e_currency_code={{QUOTE_CURRENCY_CODE}}
&status={{STATUS}}
&stage={{STAGE}}
&has_upsell={{HAS_UPSELL}}
&has_ancillaries={{HAS_ANCILLARIES}}"
width="1" height="1" style="display:none;" />
Limitations
- Cannot be fired multiple times on each page load
- Cannot track standard or custom events triggered by UI interactions (e.g., a button click)
- Subject to HTTP GET limits in sending custom data or long URLs
- Cannot be loaded asynchronously
3. Server to Server Implementation (Recommended)
Send tracking events directly from your backend services. This approach mirrors the Image Pixel method, but the request is made from your server rather than the user's browser. It improves reliability and ensures events are captured even if client-side code fails or users block pixels.
Server to Server Example
https://srv.wego.com/analytics/v3/landings/event
?conversion_id={{CONVERSION_ID}}&click_id={{WEGO_CLICK_ID}}
&total_quote_value={{TOTAL_QUOTE_VALUE}}"e_currency_code={{QUOTE_CURRENCY_CODE}}
&status={{STATUS}}
&stage={{STAGE}}
Mobile Websites
If your mobile website is separate from your desktop site, add the pixel tracking to both.
Parameters
Update the parameters in the code above based on these values:
| Field | Value Type | Required | Parameter Description |
|---|---|---|---|
conversion_id | string | yes | a unique Partner's identifier in the Wego system (constant value). Please request this id from your wego account manager if not provided. This will be the same value used in the conversion tracking |
click_id | string | yes | tracking parameter retrieved from deeplink URL |
total_quote_value | string | yes | total price for the itinerary including any applicable charges and/or payment fees. If there are multiple price available, send the lowest price. |
quote_currency_code | string | yes | the ISO 4217 3-letter currency code for the total_quote_value |
status | string | yes | validity of itinerary from the deeplink - available → the selected fare is available- not_available → the selected fare is no longer available- invalid → invalid handoff link |
stage | string | yes | identifier to indicate the type of page the user is viewing. Each stage only needs to be triggered after the page has been fully loaded. - search-page : page where users can still select other flights and/or fare options.- booking-page : page where user input passenger details and/or ancillaries.- checkout-page : page where user input payment details and create their booking. |
has_upsell | boolean | no | optional, indicate if a higher fare class (e.g Refundable Rate) is selected - true → higher fare class than the original fare is selected- false → higher fare class than the original fare is selected |
has_ancillaries | boolean | no | optional, indicate if there are any ancillaries (e.g insurance, baggage) is selected - true → user has selected at least one ancillaries- false → no ancillaries are selected |
How to test the Pre-Conversion Pixel
- Open "Developer tools" in Google Chrome and select the Network Tab
- Make a handoff from Wego to your site
- Check for entry that starts with
event? - Validate the values in the Payload Tab
Sample Trigger and Requests
For a partner with conversion_id = c-wego-partnerid receiving a user with a click_id = 554468965s2h73d5
| Scenario | JS Library | Img Tag | Server to server (cURL) |
|---|---|---|---|
| Fare Available - Search Page User lands on the search page, the fare is available with a total of SGD 280.00 | wego('track', 'Landing', {total_quote_value: '280.00',quote_currency_code: 'SGD',status: 'available',stage: 'search-page'}); | <img src="https://srv.wego.com/analytics/v3/landings/event?conversion_id=c-wego-partnerid&click_id=554468965s2h73d5&total_quote_value=280.00"e_currency_code=SGD&status=available&stage=search-page"width="1" height="1" style="display:none;" /> | curl https://srv.wego.com/analytics/v3/landings/event?conversion_id=c-wego-partnerid&click_id=554468965s2h73d5&total_quote_value=280.00"e_currency_code=SGD&status=available&stage=search-page |
| Fare Not Available - Checkout Page User lands on the checkout page page, but the fare is no longer available | wego('track', 'Landing', {status: 'not_available',stage: 'checkout-page'}); | <img src="https://srv.wego.com/analytics/v3/landings/event?conversion_id=c-wego-partnerid&click_id=554468965s2h73d5&status=not_available&stage=checkout-page"width="1" height="1" style="display:none;" /> | curl https://srv.wego.com/analytics/v3/landings/event?conversion_id=c-wego-partnerid&click_id=554468965s2h73d5&status=not_available&stage=checkout-page |
| Invalid Handoff Link - Search Page User lands on an invalid search page link | wego('track', 'Landing', {status: 'invalid',stage: 'search-page'}); | <img src="https://srv.wego.com/analytics/v3/landings/event?conversion_id=c-wego-partnerid&click_id=554468965s2h73d5&status=invalid&stage=search-page"width="1" height="1" style="display:none;" /> | curl https://srv.wego.com/analytics/v3/landings/event?conversion_id=c-wego-partnerid&click_id=554468965s2h73d5&status=invalid&stage=search-page |
| Ancillaries Selected - Checkout Page User lands on the checkout page, after adding ancillaries | wego('track', 'Landing', {total_quote_value: '280.00',quote_currency_code: 'SGD',status: 'available',stage: 'search-page',has_ancillaries: true}); | <img src="https://srv.wego.com/analytics/v3/landings/event?conversion_id=c-wego-partnerid&click_id=554468965s2h73d5&total_quote_value=280.00"e_currency_code=SGD&status=available&stage=search-page&has_ancillaries=true"width="1" height="1" style="display:none;" /> | curl https://srv.wego.com/analytics/v3/landings/event?conversion_id=c-wego-partnerid&click_id=554468965s2h73d5&total_quote_value=280.00"e_currency_code=SGD&status=available&stage=search-page&has_ancillaries=true |
| Upsell Selected - Booking Page User lands on the booking page, after choosing a higher fare class | wego('track', 'Landing', {total_quote_value: '280.00',quote_currency_code: 'SGD',status: 'available',stage: 'search-page',has_upsell: true}); | <img src="https://srv.wego.com/analytics/v3/landings/event?conversion_id=c-wego-partnerid&click_id=554468965s2h73d5&total_quote_value=280.00"e_currency_code=SGD&status=available&stage=search-page&has_upsell=true"width="1" height="1" style="display:none;" /> | curl https://srv.wego.com/analytics/v3/landings/event?conversion_id=c-wego-partnerid&click_id=554468965s2h73d5&total_quote_value=280.00"e_currency_code=SGD&status=available&stage=search-page&has_upsell=true |
Testing in Staging
To test the pre-conversion pixel implementation in staging, you will need to contact your account manager to have your IP address to be whitelisted first and receive the URL addresses for the JS Library and/or Img pixel.
Solutions for common implementation problems
- Check for spelling mistakes / typos / wrong encoding.
- If you are using server-side programming to fill in the required values, make sure you are passing the correct values.
- If all else fails, please send over the pixel code you have implemented to your Wego Account Manager for troubleshooting.
- The Pre-Conversion pixel need to be triggered at least once the first time user reached your page from Wego. In case there are multiple stages in your booking flow, you can trigger the Pre-Conversion pixel multiple times using the same click_id on each page load.