The Travel Basket widget supports basic conversion tracking with third-party tools such as Google Tag Manager.
This example uses Google Tag Manager as a demonstration of how to set up your Travel Basket widget for conversion tracking, but a similar approach can be used for other tracking scripts.
If you would like assistance with setting up your tracking scripts, or would like to combine multiple scripts so you can track with different platforms, please open a support ticket.
Below is an example of a Google Tag Manager script you may be presented with (this is an example, please do not use on a real website). You will need to split this code up into a couple of parts before it will work in the widget.
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-123456789"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-123456789');
</script>
Step 1 - Add the script tag into your basket page
Similar to our Elements Script, within your website builder/CMS, add the following to the page (you may need to add to all pages of your website). Do not add this line to the widget Tracking Code (Javascript) field. If you are using the Travelgenix/Duda CMS, you can just add your tracking code (eg. AW-123456789) into the SEO & Settings > Google Tools section and don't need to add the line of code below.
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-123456789"></script>
Step 2 - Add the script code to the Travel Basket Custom JS widget setting
Extract the Javascript code from within the <script> and </script> tags and place this within the Tracking Code (Javascript) field in the Travel Basket widget. Make sure not to include the <script and </script> tags.
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-123456789');
Add order data to your tracking code
We support a few custom tags that you can add into your tracking code that allows a few pieces of order data to be passed into your tracking.
| Tag | Example | Description |
| {ORDERREF} | ORDER12345 | Order reference for the booking |
| {ORDERAMOUNT} | 199.99 | Order total amount (number) |
| {ORDERCURRENCY} | GBP | Order currency (3-letter currency code) |
Example of the full tracking code to push purchase data to Google Tag Manager:
window.dataLayer = window.dataLayer || [];
function gtag(){window.dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-123456789');
gtag('event', 'purchase', {'transaction_id':'{ORDERREF}','value':{ORDERAMOUNT},'currency':'{ORDERCURRENCY}'});
Once these are added, when a basket/order is completed on your website, the conversion tracking will be run and the data sent to Google Tag Manager.
Comments
0 comments
Article is closed for comments.