Skip to main content

Tracking data layer events


To use the data layer on a site, the data layer module must be enabled for the site.

You can monitor the data layer for data pushes. Every dataLayer.push() call on a page triggers a dataLayer event, which you can listen to. You can use the event to fire a trigger, or you can handle the event with your own code. To access the data that was pushed, simply get the last item in the dataLayer array when you handle the event.

For example, if you want to know when services other than the Frosmo Platform push data to the data layer, track their dataLayer events.


The actual event name is defined in the constant frosmo.easy.EVENT_DATALAYER, but the event is exposed as dataLayer, which is a string value that you can reference.

The following figure shows an example of a trigger that uses the Data layer event evaluation point. With this evaluation point, the trigger gets fired every time a dataLayer event occurs on a page. You can use trigger rules to target only certain events.

Trigger for tracking data layer events
Figure: Trigger for tracking data layer events

Example: Tracking Google Tag Manager events with a trigger

To track data layer pushes from Google Tag Manager with a trigger:

  1. In the Frosmo Control Panel, in the sidebar, select More > Triggers.

  2. Click Create trigger.

  3. Define the following settings:

    • Name: Enter a descriptive name for the trigger, such as "When the data layer gets a Google Tag Manager push".

    • Evaluation point: Select Data layer event.

    • Rules: Click Add new rule, click Event data, and set the following rule:

      The data value of the event property begins with ["gtm"].

      This means that the trigger fires if the event data contains an event property whose value is a string that starts with gtm. For example, an event property with the string value gtm.js will fire the trigger.

    Trigger settings for tracking Google Tag Manager events
  4. Click Save.

You have created a trigger that gets fired every time a dataLayer.push() call contains an event property with a string value that starts with gtm. You can now use the trigger in conversion definitions, placements, segments, or shared code, depending on how you want to handle Google Tag Manager events.

For more information about trigger settings, see Creating and editing a trigger.