Skip to main content

Google Analytics 4 Guide

Each widget supports event tracking through Google Tag Manager.

Google Tag Manager configuration

The following guidance, shows the Google Tag Manager configuration with its events and parameters, used in our Widgets, for the Tracking in Google Analytics 4.

For a full description of the supported events and parameters visit the "Event" section for each widget.

Events

We only use predefined and recommended Events from Google, which automatically show up in your Google Analytics 4 Property, once activated via Google Tag Manager.

Predefined Google Events

Event Name
search
view_item
view_item_list
select_item
add_to_cart
remove_from_cart
begin_checkout
add_payment_info
purchase
generate_lead

Parameters

Parameters are used to provide context for events. Except two custom paramaters (arrival and departure, which are not supported by Google yet), we only use predefined and recommended Parameters from Google.

Predefined Google Parameters

Parameter Name
affiliation
coupon
currency
payment_type
search_term
transaction_id
value
items

Custom Parameters

Parameter Name
arrival
departure

Activate Custom Parameters in your Google Analytics 4 Reports

Custom parameters do not show up in your Google Analytics 4 Reports, until they are added as custom metrics under Google Analytics 4 -> Events -> Custom Definitions -> Custom metrics.

Add custom metrics for custom parameters

Data Layers

All the paramaters are passed from our Widgets to the Google Tag Manager via Data Layers.

Import preconfigured Google Tag Manager Template

You can use our preconfigured Google Tag Manager Template, by importing it in your Google Tag Manager Container.

In your Google Tag Manager Container go to Admin and click on Import Container.

Import the GTM Template

Select our template with the name HGV_GA4_Widget-Events.json and import it in your current workspace and confirm the import.

Import configuration of the GTM Template

Once imported, change the GA4 Tracking ID placeholder to your own Tracking ID.

Change the GA4 Tracking ID

Everything is configured now. By submitting your Google Tag Manager Container you enable the Google Analytics 4 Event Tracking.

Configure Google Tag Manager on your own

If you want to configure the Google Tag Manager container on your own, you need to create the Tags, Triggers and Variables.

Create Variables

Our widgets use Data Layer Variables for the parameters. For each parameter you want to create an own Data Layer Variable with the name of the parameter. You can find the paramater names in the Parameter section.

Creation of a Data Layer Variable

Create the Trigger

To trigger the Google Analytics 4 Tag, with the events and parameters, you want to create a custom Event Trigger with the regular expression .*. Furthermore, it is really important to fire this trigger only on some custom events, where the Data Layer Variable affiliation begins with HGV, or else this trigger will be fired for every event on a website.

Creation of the Trigger

Create the Tag

Last but not least, create a GA4 Event Tag and add your GA4 Tracking ID. Under Event Name insert the predefined Google Tag Manager variable @{{Event}}.

Creation of the Event Tag

Under Event Parameter you have to add the Parameter names you wish to use. As value you choose the corresponding Data Layer Variable.

Add Parameters in the Event Tag

As the Trigger for this Tag you want to choose the Trigger which you created in the step above.

Add Parameters in the Event Tag

You can now submit your Google Tag Manager Container, to start the Google Analytics 4 Event Tracking.