MetaLocator supports installation of Google Tag Manager inside the IFRAME. We also support communication with the dataLayer on the host page. This article helps determine which strategy is best for your application.
Google Tag Manager inside the MetaLocator iframe
MetaLocator can load Google Tag Manager directly inside the embedded MetaLocator iframe. In this configuration, the locator has its own GTM container and its own dataLayer, separate from the parent website.
This means events such as searches, location views, lead submissions, direction clicks, or other locator interactions are pushed into the iframe’s internal dataLayer.
This option is useful when:
You want MetaLocator events managed independently from the host website.
The website team does not want to modify the parent site’s GTM setup.
The locator is embedded across multiple websites and needs consistent tracking.
You want MetaLocator-specific tags, triggers, and variables isolated from the rest of the site.
The important limitation is that the iframe is a separate browser context. Events inside the iframe are not automatically visible to the parent page’s GTM container unless additional cross-frame communication is configured.
Pushing events to the host page dataLayer
MetaLocator can also communicate with the host page and push tracking events directly into the parent website’s dataLayer.
In this configuration, events that occur inside the MetaLocator iframe are sent to the host page, where they become available to the website’s existing Google Tag Manager container.
This option is useful when:
Your website already has a primary GTM container.
Your analytics team wants all events, including MetaLocator events, managed in one place.
You want locator activity included in the same GA4, Google Ads, Meta Pixel, or other marketing tags used by the rest of the website.
You want events attributed within the broader page/session context of the host website.
This approach usually requires that the host page allows MetaLocator to communicate with it and that the website’s GTM container has triggers configured to listen for the MetaLocator events.
Comparing Host Page v.s. Inside the IFRAME
The main difference is where the tracking event is handled.
Option | Where GTM runs | Where events are pushed | Best for |
GTM inside the iframe | Inside MetaLocator’s iframe | MetaLocator iframe | Isolated MetaLocator tracking |
Host page dataLayer integration | On the parent website | Host page | Unified site-wide analytics |
Which option is best?
Customers should use GTM inside the iframe when they want MetaLocator tracking to be self-contained and easy to manage separately.
Customers should use host page dataLayer events when their analytics team wants MetaLocator activity to flow into the same GTM and analytics configuration used by the rest of the website.
Some customers may use both, but in most cases we recommend choosing one primary tracking strategy to avoid duplicate analytics events.
Configuring MetaLocator to pushing events to the host page dataLayer
In this scenario, Google Tag Manager doesn't need to be instantiated inside MetaLocator.
Be sure GTM is properly installed on the page in which the Interface is installed.
Set GTM: Send Events from Host Page to Yes.
Do not provide a GTM Container ID
Set Google Tag Manager: Push Events to Data Layer from MetaLocator to Yes.
Installing Google Tag Manager Inside the IFRAME
In this scenario, Google Tag Manager can be installed as follows:
Obtain your GTM Container ID, (
GTM-XXXXXXX) from Google Tag Manager.Click Interfaces
Click Edit next to the name of the Interface that requires Google Tag Manager
Click the Analytics Tab in the Interface Builder
Paste your GTM Container ID into the setting as shown below. You may need to click "More Analytics Features" as shown below:
Capturing MetaLocator Events with Google Tag Manager
Google Tag Manager allows for fine control and authority as to what is pushed to Google Analytics by way of the various events and triggers configured in GA4. 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.
Basic Setup with 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
Ensure the Google Tag Managers Installation code is installed on your host page.
Ensure the Google Analytics ID is provided in the Google Analytics ID setting under Analytics Settings as shown below.
Enable the "Cross Domain tracking via Google Tag Manager Support" 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.




