All Collections
Analytics
Using Google Tag Manager and Universal Google Analytics with MetaLocator
Using Google Tag Manager and Universal Google Analytics with MetaLocator

MetaLocator supports Google Analytics and Google Tag Manager

Michael Fatica avatar
Written by Michael Fatica
Updated over a week ago

This article discusses how to track activity in MetaLocator in 3rd party analytics platforms, primarily Google Analytics.

Basic Setup with Google Universal Analytics

The simplest setup available is found under Analytics Settings as shown below. Simply provide the Google Universal Analytics ID as shown below under Analytics Settings > Google Analytics ID. Copy and paste the ID into the setting and save the Interface. The ID starts with "UA" and then a series of numbers and dashes.

If provided, MetaLocator will send MetaLocator Analytics Events to the Google Universal Analytics property identified by the UA code above.

Basic Setup with Google Universal Analytics and Cross Domain Support

In a typical setup, the Google Analytics installed above is also the Google Analytics used for tracking analytics events on the parent, or "host" Web site where MetaLocator is installed. Without cross domain support, a new Visitor would be generated when the user viewed the page with MetaLocator installed. This can artificially increase the number of Visitors since the visit to the page inside the MetaLocator interface will appear as a brand new visitor to Google.

Enabling Cross Domain support causes MetaLocator to find and pass a Google Analytics Client ID to from the host page to the MetaLocator IFRAME. This ensures that the Google Analytics events triggered by MetaLocator are associated with the same Google Analytics session as the one generated when the user first visited the host website.

To enable Cross Domain support, perform the following setups

  1. Ensure the Google Universal Analytics Installation code is installed on your host page.

  2. Ensure the Google Analytics ID is provided in the Google Analytics ID setting under Analytics Settings as shown below.

  3. Enable the "Cross Domain tracking via Universal Analytics setting" as shown below:

3. Ensure you add the domain of the host page (E.g. yourdomain.com) to the referral exclusion list according to these instructions.

Using Google Tag Manager

Google Tag Manager, or GTM for short, is a platform provided by Google that allows users to execute tags based on triggers. Examples of tags include:

  • Google Analytics

  • HotJar

  • OneTrust/TrustArc

Examples of triggers include

  • Page Load

  • Click

Google Tag Manager Installation

Most commonly, GTM is used by MetaLocator customers to invoke Google Analytics tags. In this scenario, Google Tag Manager script is added to MetaLocator in two steps, since the Google Tag Manager script is provided in two parts as shown below:

  1. Paste the first segment into Advanced > Custom Head Tag

  2. Paste the second segment into Advanced Custom Opening Body Tag

Google Tag Manager with Google Universal Analytics

Within Google Tag Manager, a Universal Analytics Tag must then be configured to be triggered on Page View. To configure Universal Analytics and to include cross-domain support, configure the tag as shown below:

In this configuration, MetaLocator will not push the custom MetaLocator Analytics events into Google Universal Analytics. The events captured and reported to Google Analytics can and must be completely controlled by Google Tag Manager.

Capturing MetaLocator Events with Google Tag Manager with Google Universal Analytics via the Data Layer

As described above, Google Universal Analytics via GTM allows for fine control and authority as to what is pushed to GA by way of the various tags and triggers configured in Google Tag Manager. However, MetaLocator can also push events to the Google Tag Manager data layer. The data layer events can then be used to create variables and triggers for further customization. To enable data layer events, enable the Push Events to Data Layer option as shown below:

With the above setting enabled, the MetaLocator Analytics Events will be pushed onto the Data Layer along with the Event Context variables, prefaced by "ml_". The Event Context is the data that tells the analytics system the context in which the analytics event occurred.

For example, the OpenMarkerWindow event is pushed as shown below, and the context includes the Location ID and Item ID associated with the OpenMarkerWindow event.

Tags can then be triggered in response to Data Layer Events and those tags can leverage the Context Variables to push data into Google Analytics or 3rd party analytics platforms such as Adobe Experience Manager, Segment, Amplitude or Mixpanel.

Google Tag Manager Event Deduplication

In most customer configurations, Google Tag Manager is also installed on the host page. This means that any Tags set to run on common Triggers like "Page Load" will run once on the host page and then again within MetaLocator. Sometimes this can result in undesired double-execution of tags, such as prompting for cookie permission on both the host page and the MetaLocator IFRAME.

To avoid undesired duplication:

  1. Create a Tag Manager Container just for MetaLocator

  2. Create Triggers that are MetaLocator-Only.

For scenario 1, the installation code will be MetaLocator-specific, ensuring that all Tags and Triggers will only apply to MetaLocator. For scenario 2, a page view trigger such as the following will suffice:


Did this answer your question?