How To Set Up Google Analytics & Cross-Domain Conversion Tracking
FollowOverview
Get a deeper understanding of your customers. Google Analytics gives you the free tools you need to analyse data for your business in one place.
Note: If you're new to Google Analytics, we recommend setting up and connecting the recently released Google Analytics 4, click here to learn more.
How to add Google Analytics 4 (GA4) to your existing Universal Analytics (UA)
If you already have an existing UA implementation, you can add a new GA4 property to it, in order to collect events for both (UA & GA4). This could ease the transition to GA4, in preparation for abandoning the older UA implementation at a later date.
Rezdy supports this feature, which requires connecting the relevant tags at within your Google Analytics. Please see the following pages for more information:
- Add Google Analytics 4 to an existing Universal Analytics implementation
- Add a Google Analytics 4 property (to a site that already has Analytics)
- [GA4] About connected site tags
- Use GTAG consistently with your implementation on your website, and only reference your UA Tracking ID (e.g.:UA-XXXXX) as we outlined here.
- Ensure you use your UA Tracking ID only in your Rezdy setup.
Cross-domain Checklist
- Ensure you have added your website domain (mywebsite.com) to your referral exclusion list. This is a mandatory step and more information can be found here.
- Ensure you have your GA tracking code entered correctly in Rezdy (Integrations > Google > Tracking Code).
- Enter the Linked Domain as your website domain (mywebsite.com) in Rezdy (Integrations > Google > Linked Domain).
- Ensure Ecommerce tracking is enabled in Rezdy (Integrations > Google > Enable Ecommerce Tracking).
- If you are embedding a book now button or a booking widget, ensure you include the javascript when pasting the code snippet into your website builder.
Note: Cross-Domain tracking is a Analytics feature. You can read the full tutorial from Google. We recommend consulting a web developer to assist.
Set up Google Analytics directly on your website (gTag)
Note: If you choose to set up GA using gTag, you do not need to complete the GTM method.
- Replace UA-1234567890-1 with your Tracking ID and install on your website's header.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-1234567890-1"></script>
<script>
window.dataLayer=window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-1234567890-1', {
'linker': {
'domains': ['rezdy.com']
}
})
</script>
Important: The above code should replace your existing code, and only appear once on each page.
Cross domain for iframe integrations
If you are using iframes to integrate the Rezdy booking form on your Website (I.e. our Product Details widget), Google's auto Linker plugin will not work.
You need to implement a more advanced solution, as per Google's instructions. A listener is automatically added on Rezdy's end, but you must add extra code on your main domain to send messages.
We've provided a sample code, note it is an example and will need to be customized further depending on your website. For example, you may have plugins or errors that can conflict with that script. A JavaScript developer will understand it and can fix issues if things don't work as expected.
- Replace https://myalias.rezdy.com with your Rezdy URL.
- Integrate this code on either in your header/footer (this needs to be on every page).
- Set the script to trigger on window loaded DOM Ready.
<script>
function check_ga() {
if (typeof ga==='function') {
ga(function(tracker) {
// When using Google Tag Manager there is no default tracker
if (tracker==undefined) {
tracker=ga.getAll()[0];
}
// Gets the client ID of the default tracker.
var gaClientId=tracker.get('clientId');
// Gets all iframes on the page
var rezdyElements=document.getElementsByClassName('rezdy');
for (var i=0; i < rezdyElements.length; i++) {
if (rezdyElements[i].contentWindow) {
// Wait for Iframe receiver to be loaded
rezdyElements[i].addEventListener("load", function() {
// Make sure you use your own company Alias here
this.contentWindow.postMessage(gaClientId, 'https://myalias.rezdy.com');
});
}
}
});
} else {
setTimeout(function(){check_ga();},500);
}
}
check_ga();
</script>
Set up Google Analytics using Tag Manager (GTM)
Note: If you choose to set up GA using GTM, you do not need to complete the gTag method.
- On the Workspace Overview screen, click New Tag.
- Click Tag Configuration and choose Universal Analytics.
- Select Pageview as the Track Type.
- Create a new Google Analytics Settings Variable.
- Enter your Tracking ID.
- Click More Settings -> Cross Domain Tracking.
- Under Auto Link Domains enter "rezdy.com".
- Click Triggering and choose All Pages (or appropriate choice for your setup).
- Click Save, Submit and Publish.
Cross domain for iframe integrations
If you are using iframes to integrate the Rezdy booking form on your Website (I.e. our Product Details widget), Google's auto Linker plugin will not work.
You need to implement a more advanced solution, as per Google's instructions. A listener is automatically added on Rezdy's end, but you must add extra code on your main domain to send messages.
We've provided a sample code, note it is an example and will need to be customized further depending on your website. For example, you may have plugins or errors that can conflict with that script. A JavaScript developer will understand it and can fix issues if things don't work as expected.
- Replace https://myalias.rezdy.com with your Rezdy URL.
- Integrate this code on either in your header/footer (this needs to be on every page).
- Set the script to trigger on window loaded DOM Ready.
<script>
function check_ga() {
if (typeof ga==='function') {
ga(function(tracker) {
// When using Google Tag Manager there is no default tracker
if (tracker==undefined) {
tracker=ga.getAll()[0];
}
// Gets the client ID of the default tracker.
var gaClientId=tracker.get('clientId');
// Gets all iframes on the page
var rezdyElements=document.getElementsByClassName('rezdy');
for (var i=0; i < rezdyElements.length; i++) {
if (rezdyElements[i].contentWindow) {
// Wait for Iframe receiver to be loaded
rezdyElements[i].addEventListener("load", function() {
// Make sure you use your own company Alias here
this.contentWindow.postMessage(gaClientId, 'https://myalias.rezdy.com');
});
}
}
});
} else {
setTimeout(function(){check_ga();},500);
}
}
check_ga();
</script>
Tip: More information can be found here via the Google support article
Rezdy setup
- Click Integrations.
- Click Google.
- Tracking Code: Tracking code format: UA-XXXXXXXXX-X.
- Analytics Type: select your Google Analytics type.
- GTag (recommended).
- Universal GA.
- Legacy GA.
Note: If you do not see the option to select an Analytics Type: this is because GTag is automatically selected by default.
- Use AMP Client ID: Checking this box will set the useAmpClientId GA property as TRUE
- Linked Domain: enter your source domain that links to Rezdy (e.g. mycompany.com). Do not type http or www.
- Enable Ecommerce Tracking?: Only if you want to track your booking form orders
- Click Save Google Analytics.
Comments
0 comments
Article is closed for comments.