This feature can be used with the following license packs: Professional, Enterprise
Introduction
This document serves as an instruction for implementing Google Analytics (GA) to Lyyti and enabling cross-domain tracking between Lyyti and customer sites.
Currently there are two Google Analytics tag versions that can be used: Global Site Tag (GTAG) and analytics.js. In this case, we use Global Site Tag as it's already implemented in Lyyti. Global Site Tag is also the newest tag version and should be used if possible as it simplifies the usage of cross domain tracking and event creation.
Lyyti tag configuration
Following analytics tag configuration is required to Lyyti site in order to enable Google Analytics together with cross domain tracking between Lyyti and customer sites.
Additional analytics event is also required in order to track event registrations.
Tags and scripts will be inserted using custom code section. Please remember to clean Tracking ID from Google Analytics section on Lyyti site if it has been enabled.
Google analytics tag
Global Site tag will be used on Lyyti site. Tag will be inserted using the custom code insertion method. Custom code insertion is used in order to enable cross domain tracking between domains.
Replace [UA-XXXXXX-X] values with Google Analytics property ID and add the code to the custom code section. Script needs to be loaded on all form pages.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=[UA-XXXXXXX-X]"></ "></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
'linker': {
'accept_incoming': true
}
});
</script>
Event for registrations
In order to follow registrations on Lyyti site, a custom script needs to be added to the custom code section. Script will send an event to Google Analytics when user views thank you page. Event will take the document.title variable and use it as event_label value.
Add the below script to the custom code section just below the Global Site Tag.
<!— Registration tracking -->
<script>
try {
var url = document.URL;
var result = "?p=save&uid=";
if (url.includes(result)) {
gtag('event', 'Sent', {
'event_category': 'Registration',
'event_label': document.title
});
}
}
catch (error) {
}
</script>
Above script will send an event to Google Analytics with the following specifications:
Category |
Registration |
Action |
Sent |
Label |
[Name of the Lyyti event] |
Label field contains the actual Lyyti event name. Event label should be checked from Google Analytics reporting before creating an actual goal.
Above solutions creates unique Google Analytics events for all future Lyyti events so no additional modification is required in order to track additional Lyyti events.
Customer site tag configuration
Customer site requires a Google Analytics tag that has cross-domain tracking enabled. It is preferred to use Global Site Tag but legacy Analytics.js tag can also be used. Please use one of the tag versions that are described in the following sections.
Google Analytics using Global Site Tag
Following tag needs to be installed into head section of all pages (in customer's website). Tag is configured so that it will create a cross-domain link between customer and Lyyti sites. If GTAG is already installed on customer site, make sure the config section is updated.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=[UA-XXXXXXX-X]"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '[UA-XXXXXXX-X]', {
'linker': {
'domains': ['lyyti.fi', 'lyyti.in']
}
});
</script>
Tracking ID: [UA-XXXXXXX-X] This should contain the Google Analytics property ID. This ID has to be the same as the one on Lyyti site.
Google Analytics configuration
Customers current Google Analytics account requires modifications in order for the cross-domain tracking to work. Below are the most important configuration items that need to be in place.
Property and view structure
Each property should have at least two views, one for unfiltered and filtered data. Google offers the following view structure it would like GA users to use. All goal should be created to User data view.
Property |
View name |
Global Settings |
CustomerSite.com |
00 Master data - customerSite.com MM/YY |
No filters in this view. |
CustomerSite.com |
01 Basic data - customerSite.com MM/YY |
Bots, internal traffic filtered. |
CustomerSite.com |
02 User data - customerSite.com MM/YY |
Same than 01 but custom filtering, goals etc. |
Property settings
Property (domain level) settings should use the following configuration:
Property Name: [customerSite.com]
Default URL: [customerSite.com]
Default View: [Main reporting view]
User data view that was described in section 4.1 should be used here.
Industry Category: [Customers industry]
Enable Demographics and Interest Reports:
View settings
View settings for Master data and User Data are rather similar excluding bot filtering that should not be enabled for Master data.
Configuration:
View Name: [Descriptive view name]
View naming that was described in section 4.1 can be used.
Website’s URL: [customerSite.com]
Use customers site URL in here.
Time zone country or territory: [Finland]
Use customers country.
Currency displayed as: [EUR]
Use customers currency.
Bot filtering: [enable]
Rember not to enable this in Master Data view.
Query parameter: [Parameter for internal search query]
This can be left empty if no parameter is set in URL.
Referral exclusion
Referral exclusion list needs to contain both lyyti (if redirect from lyyti.in is used) domains and the customerSite.com domain in order for the cross-domain tracking to work. Referral exclusion is done on property level.
Exclusion list can be found from admin panel: Tracking Info -> Referral Exclusion List
Conversion for registration event
In order to use GA conversion reporting a goal needs to be created to User Data reporting view.
We need to use the event that was created in section 2.2. Goals are created in view level and configuration can be found from Admin panel -> Goals
Goal for the event that was created should use the following configuration:
Custom Goal
Goal Name: [Descriptive name for the event]
Goal Slot ID: [Select the first free goal ID]
Remember not to overwrite existing ones.
Type: Event
Category |
Equals to |
Registration |
Action |
Equals to |
Sent |
Label |
Equals to |
[Name of the event] |
Values that were given in section 2.2 for the event should be used here. Remember to use the actual Lyyti event name.
Viewing Lyyti GA registration events
Event labels can be viewed by selecting Behaviour -> Events -> Top Events from reporting and selecting Registration from event category list.
Then Event label should be set as a primary dimension to view registration events from Lyyti.
Comments
0 comments
Please sign in to leave a comment.