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

You can only track basic custom actions with the data layer. To track visitor geolocation with custom actions, create the actions in the Frosmo Control Panel.

For an introduction to custom actions and custom action tracking in the Frosmo Platform, see Data tracking solutions. For more information about custom actions, see Feature: Custom action.

Tracking custom actions with the data layer means triggering a custom action event whenever a visitor successfully completes an action or enters a state that qualifies as a custom action. The data you pass in the custom action event (a name and a value) defines the custom action.

You can trigger custom action events from:

Page code is the recommended solution. If you cannot use the data layer in your page code, use shared code.

Tracking custom actions by triggering a custom action event from a page

Figure: Tracking custom actions by triggering a custom action event from a page (click to enlarge)

When you trigger a custom action event:

Triggering custom action events

To trigger a custom action event, call the dataLayer.push() function with a custom action object containing the custom action data:

    frosmoEvent: 'string',
    frosmoValue: 'string'

Custom action object

The custom action object contains the data of a custom action event.

Table: Custom action object properties


Name of the custom action. The name uniquely identifies the custom action.

This property maps to the Name field of a custom action in the Frosmo Control Panel.

String (128)Required

Value of the custom action. The value is case-sensitive.

This property maps to a Value field of a custom action in the Frosmo Control Panel.

String (128)Required

Custom action object examples

    frosmoEvent: 'Cookie policy accepted',
    frosmoValue: 'true'

// Set the productCategory variable

    frosmoEvent: 'Product category',
    frosmoValue: productCategory

Testing custom action tracking

To test that custom actions are correctly tracked with the data layer:

  1. Go to the site.
  2. Launch Frosmo Preview.
  3. Select Advanced > Events.

    Testing custom action tracking

  4. Go to a page where custom actions are tracked. If custom action events are successfully triggered with the data layer, Frosmo Preview shows the following messages for each event:

    Testing custom action tracking

  5. To verify that the correct custom action data was sent, check the Name or Data column for the customAction messages, as both columns show the custom action name and value.
  6. If you want more details on a data layer call, select the Advanced > Requests view in Frosmo Preview, and check the customAction request to the Events API.

    Testing custom action tracking

  7. Log in to the Frosmo Control Panel, and select your site.
  8. In the sidebar, select More > Custom Actions, and check whether the tracked custom actions are listed with the passed values.

    Testing custom action tracking

    If you define titles for the custom action values in the Control Panel, the custom actions overview displays the titles rather than the values.

    Testing custom action tracking