Set up Google Analytics 4
Google Analytics 4 (GA4) is the next generation of analytics that introduces a standardised way of tracking events from both websites and apps. Read more here.
⚠️Google will stop processing data from Universal Analytics on 1st of July 2023 so if you haven’t changed to GA4, we recommend you to do so.
Before we get started with GA4
To start tracking events in your widgets, you need to create a GA4 property and embed it on your website:
- Create an Analytics account, a GA4 property and add a data stream
- Set up GA4 on your website. This is important because our widgets use the tracker on your website to send events.
How to activate GA4 on your widget
- In the Google Analytics admin panel, locate the MEASUREMENT ID for your data stream and copy it. (picture above)
- Go to Bókun and go to Settings > Sales settings > Booking channels
- Select the booking channel
- Go to the tracking step
- Toggle the Google Analytics 4 tracking card and insert your MEASUREMENT ID into the input field
- Now the GA4 should be working on your widget
How events are handled in the widgets (technical overview)
Normally, our booking widgets are embedded in iframes. GA4 events can’t be tracked within iframes that have a different domain (url) than the website that embeds the iframe. We bypass this by making our widgets send messages to the website that is embedding the widget and track it from there.
If you have a gtag script in your website, we pass the event parameters into that function, but if gtag is not present, we try to push the event parameter into the dataLayer (for Google Tag manager).
Verifying that your events are being tracked
To verify that your events are being tracked propperly, use the debug view in the Google Analytics panel.
If you go to your website and add a product to cart, you should be seeing an add_to_cart
event in the debug view. If you are not seeing it, consider the following:
Is Google Analytics 4 active on your Bókun booking channel?
- Check your booking channel tracking step. Is GA4 active?
Is the Google Analytics 4 tracking code embedded on your website?
- If you don’t receive any events in the Debug View, like
page_view
, you need to make sure that your follow the steps in this article.
- If you don’t receive any events in the Debug View, like
Have you disabled tracking on your Booking Channel until consent is given?
- Check your booking channel tracking step. Are you awaiting tracking consent? If so, make sure your website is not awaiting tracking consent.
Events
In addition to the regular events tracked by GA4 (page-view, scroll etc.) our widgets track the following events.
Trigger | Event name | Properties | ||
---|---|---|---|---|
A search is performed on a product list widget | search | search_term: The term that was searched date_from: The start date selected date_to: The end date selected | ||
A purchase is completed | purchase | currency: The currency used for the payment transaction_id: The id of the new booking value: The value of the booking in the currency used affiliation: Bokun widgets coupon: The promo code used tax: The value of the tax in the currency used items: The items bought | ||
A product is added to cart | _add_to_cart | currency: The currency used for the payment value: The value of the item in the currency used items: The item added to cart | ||
Checkout begins | begin_checkout | currency: The currency used for the payment value: The value of the cart in the currency used coupon: The promo code used items: The items in the cart | ||
A product is removed from cart | remove_from_cart | currency: The currency used for the payment value: The value of the item in the currency used items: The item removed from cart | ||
A product list item is clicked | select_item | item_list_id: The id of the product list item_list_name: The title of the product list items: The id of the product selected | ||
A product list is viewed | view_item_list | item_list_id: The id of the product list item_list_name: The title of the product list items: The ids of the products in the list | ||
A product page or a calendar is displayed | view_item | currency: The currency selected value: The default price displayed items: The id of the product viewed |
|
Properties of items
Property name | Description |
---|---|
item_id | The id of the product |
item_name | The title of the product |
quantity | The quantity of the item |
price | The unit price of the item |
currency | The currency of the price |
discount | The unit discount of the item |
⚠️ We currently do not support GA4 tracking for WIX websites. The reason being that when we embed widgets in Wix they are put inside iframes, so we can’t send google event messages to the top window.