Skip to main content

How to configure Google Tag Manager tracking

This article explains how to configure Google Tag Manager tracking to help you understand your customer by tracking statistics for your website in addition to Bókun's built-in statistics.

Google Tag Manager is a tag management system, allowing you to easily collect data based on triggers on your website or app.

⚠️ Google will stop processing data from Universal Analytics on 1st of July 2023. It is recommended to connect your site to Google Analytics 4.

 

What do I need to setup Google Tag Manager in Bókun?

You will need your Google Tag Manager ID (GTM ID)

 

Where do I find my Google Tag Manager ID

  • Log into your Tag Manager and go to Workspace
  • On the right-hand side, close to the top of the page you can see your ID, it will be something like this: GTM-XXXXX

For more instructions, use the Tag Manager Help article titled Set up and install Tag Manager.

 

How to connect your Google Tag Manager to you Bókun account

  • Click on Settings > Sales settings > Booking channels or click here to access the booking channel page in your Bókun account.

  • Select the title of the booking channel you would like to connect your Google Tag Manager to.

  • Click on Advanced > Tracking on the left-hand side panel.

  • Enable the toggle Google Analytics and locate the box Google tag manager id. This is the box you will add your GMT ID.

 

What can I track with Google Tag Manager

You can track different events with Google Tag Manager, as example you can track:

  • Visitors reaching certain page, e.g. your booking page
  • Visitors finalizing the booking process and reaching the confirmation page. For this you could use either URL tracking, “booking-receipt”, is a part of the URL of the confirmation page. Or you can use an event “Purchase” as a trigger.

You have access to all information about the checkout process in the window variable window.__widgetStore (see more in the sections below).

To see which events are sent in the Bókun Booking process, you can set up Tag Assistant by Google to go through your booking process and see which events you would like to track.

  • ℹ️ The tag manager is a versatile tool and does allow you to use either predefined triggers, or create your custom events. The connection is in place, and we recommend using available tools to test and find what works best for your website and booking process. Keep in mind, Bókun cannot be held responsible for what you set up in Google Tag manager will work or not. Bókun only has the connection to Tag manager in place, and then it is up to the supplier to use the tool and maintain it.

For more instructions about Google Tag Manager, please access the Google Tag Manager Help articles.

 

Useful information about Google Tag Manager

On Google you have to start by creating a Tag Manager Account if you do not have one already. To access the page to create an account or to log in to your existing Tag Manager account click here

Triggers are something you can set up and customize within your Google Tag Manager.

Here are more information from Google on:

Accessing Bokun booking transaction variables within Google Tag Manager

You have access to all information about the checkout process in the window variable window.__widgetStore.

The variable is a hierarchical tree of useful data, for example, you can get the total price of the purchase using sub-variable in the tree: window.__widgetStore.shoppingCartStore.cart.totalPrice.

To explore available variables, please do some bookings using Bokun’s booking widget through Google Chrome browser, while seeing your booking, press F12 key to open Chrome diagnostics console > Sources tab >, then click a number under the Threads / Main section, expand Watch section, and click “+” to add variable window.__widgetStore (see picture below).

Now, try expanding the hierarchical tree.

Expand shoppingCartStore section > expand cart section, > customerInvoice section. Look at the values inside the variables, and you will recognize values of the booking you have just made.

⚠️ NOTE: The tree structure inside window.__widgetStore object can change over time as Bókun system evolves.

 

Defining Bókun booking transaction variables within Google Tag Manager

To define Bókun booking transaction variable within Google Tag Manager, follow the steps below:

  • Access your Tag Manager account
  • Click on section Variables
  • Click New in User-Defined Variables section

  • Click Choose a variable type
  • Click Custom JavaScript

  • Write your variable wrapped in a function(), as in the example below.
  • Specify variable name and click Save

 

How to configure Google Analytics e-commerce tracking