Because the Universal Analytics is no more processing data, it is mandatory for everyone to move to the latest version of analytics, Google Analytics 4 (GA4).
Follow the steps mentioned below to get your direct reservations (from OnRes booking engine) tracked in GA4.
Step 1: Enable cross-domain tracking
Open your Google Analytics 4 account, and follow the mentioned path:
Admin -> Property -> Data Streams -> Click on the data stream -> (Scroll down) Click on ‘Configure Tag Settings’ -> Click on ‘Configure your domains’. Add your cross domains as shown below:
Note: Add your website domain instead of ‘www.yourwebsite.com’ in the above screenshot.
Step 2: Set up your Google Tag Manager (Skip to Step 3 if this is done)
Visit tagmanager.google.com, create your account, and add a container of your website. Once done, you will receive a popup with ‘Tagging instructions’.
Instruct your website developer to add the codes as mentioned in the popup.
Step 3: Integrate your Google Tag Manager (GTM) with your Google Analytics 4 account
In your GTM container, click on ‘Add new tag’, select ‘Google Analytics: GA4 Configuration’, add the Measurement ID (from your Google Analytics 4), and select the Trigger as shown in the screenshot below.
Do not forget to give a relevant name to your tag, and submit the new configuration for it to start working.
Note: If you don’t know your GA4 Measurement ID, follow the path as mentioned:
Google Analytics > Admin > Property > Data Stream > Click on the data stream: You will see the Measurement ID mentioned there.
Step 4: Add data layer variables in GTM
Data layer variables are that piece of reservation information that you want to show in your Google Analytics reports.
Here, we have considered that you want to record four variables from your reservations:
Full name, Reservation ID, Reservation Tax, Reservation Amount
Go to your GTM, and open the ‘Variables’ from the left panel. You will see some pre-defined variables there. What we want to add are User-defined Variables. Scroll down and you will see the option to add them.
Click on ‘New’, and refer to the screenshot to add one variable.
The name you give to the variable is of utmost importance. Note it down so as not to mess it up.
Similarly, add other three variables individually. I have named my variables as below:
- transactionID (for Reservation ID),
- transactionTax (for Taxes),
- revenue (for Total Amount),
- fullname (for Guest Name)
Step 5: Add GTM Tags and Triggers for the event
In your GTM account, add a new tag, and configure it as follows:
Tag type: Google Analytics: GA4 Event
Configuration Tag: (Name of the tag you created in Step 3)
Event Name: Reservation (I have named it DemoReservation)
Event Parameters: This will include the four parameters of the data layer variables we created. Please be careful while adding the event parameters.
The Parameter Name will contain the name of the variable you kept (refer to the screenshot).
For the Value, click on the ‘+’ sign, you will see your added variables there. Select the appropriate one.
Your tag should look like this.
Next, we need to add a Trigger which will trigger the Reservation Tag we just added.
Click on ‘Triggers’ in the left panel, and refer the screenshot below to do the configuration. Note that my event name was ‘DemoReservation’, and that’s the name I add here. You add the event name which you have picked and saved.
Do not forget to name your Trigger properly, and then submit the entire container again.
Note: Whatever changes you make in GTM, will reflect in 24 hours. So, be patient for things to show up.
Step 6: Populating the data layer variables with the right information
Now, you need to integrate your GTM with the OnRes booking engine, for which, you need to combine your GTM installation code from Step 2 with the data layer script.
Contact the OnRes support team and ask them to add the following code snippet to reflect on your booking engine.
Snipped to be added in "Web"
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-[Your GTM Container Code]"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
Snipped to be added in "Processed"
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-[Your GTM Container Code]');</script>
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'transactionId': '<#ReservationID#>',
'revenue': <#TotalCost#>,
'transactionTax': <#TotalTaxes#>,
'fullname': '<#GuestName#>',
'event':'[Event Name]',
});
</script>
<noscript><iframe src=https://www.googletagmanager.com/ns.html?id=GTM-[Your GTM Container Code] height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager -->
Note: The details in BOLD are variable information which you need to add.
Step 7: Mapping the data layer variables with custom parameters
The last leg, all you need to do is map your event parameters (data layer variables) with the custom dimensions in GA4.
Open Google Analytics 4 > Admin > Property > Custom Definitions > Click on ‘Create Custom Dimension’
Your screen should look like below.
The Dimension name should be the parameter that you want to see getting tracked, for example, Reservation ID.
The Scope would be Event since we are tracking event parameters.
The Description is for internal explanations and optional.
The Event parameter will be the exact same data layer variable that you added in Step 4.
This way, you have four custom dimensions to add, corresponding to the four data layer variables.
It should look something like below:
Save your custom dimensions. Wait for a minimum of 24 hours for GA and GTM to digest the changes.
Step 8: Track reservation revenue in GA4
To check the revenue tracking of your reservations in GA4, go to Reports > Engagement > Events.
Once you scroll down, you will find a list of all events getting tracked. Find the event you added in the GTM (here, DemoReservation). Click on it.
You will see a detailed report of that particular event, with revenue, and other variables we tracked.
There you have it. Integrate your OnRes booking engine with the Google Analytics 4 (GA4) through GTM to track your revenue and reservations.