Passa ai contenuti principali

How to configure Google Tag Manager tracking

Understand your customer better by tracking statistics for your website with Google Analytics 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.

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

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

  • Click on Settings > Booking channels

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

  • Click tracking on the left hand side panel. Then add your Google Tag Manager ID in field.

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 Tag manager will work or will work forever. Bókun only has the connection to Tag manager in place, then it is up to you to use the tool and maintain it as you see fit.

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: https://tagmanager.google.com/#/home

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 booking using Bokun’s booking widget using Chrome browser, then, while seeing your booking, press F12 key to open Chrome diagnostics console, then click ‘Sources“ tab, then click a number under the “Threads / Main” section, then, expand “Watch” section and click “+” to add variable “window.__widgetStore” (see picture below).

Now, try expanding the hierarchical tree: expand "shoppingCartStore" section, then expand "cart" section, then "customerInvoice" section. Look at values inside variables and you will recognize values of the booking you have just made.

NOTE that the tree structure inside window.__widgetStore object can change over time as Bokun system evolves.

Defining Bokun booking transaction variables within Google Tag Manager

To define Bokun booking transaction variable within Google Tag Manager:

  • 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