A custom action is any visitor action or state that you want to track and interact with on a website, and that is not a conversion, transaction, or product view. A custom action can be, for example, a button click, form submission, or login status. You can use custom actions to segment visitors, fire triggers, and control whether to display modifications.
What is custom action tracking?
Custom action tracking is the process of monitoring visitors for actions and state changes that qualify as custom actions, and collecting the data about those actions and state changes (custom action data). The data is stored in the Frosmo back end.
Custom action tracking allows you to dynamically react to visitor behavior that is not tracked by conversions, transactions, or product views. You can use custom actions to, for example, show variable content based on the page a visitor is viewing or the city they are in.
Figure: Custom action tracking in the Frosmo Platform (click to enlarge)
Custom actions are not included in the statistics that you can view in the Frosmo Control Panel. If you want to track a visitor action or state with statistics, track it as a conversion instead.
For more information about custom actions, the different types of custom actions, and how to use custom actions with other features, see the custom actions user guide.
Segmenting visitors based on custom actions
You can implement segmentation with a custom action in one of two ways:
- Implement the custom action tracking on your site, wait for visitors to complete the custom action so that the action gets stored in the Frosmo back end along with its values, and then create the related segments in the Control Panel.
- Create the custom action with the necessary values in the Control Panel, create the related segments, and then implement the custom action tracking on your site.
For more information about segmenting visitors based on a custom action, see the custom actions user guide.
Tracking custom actions with the data layer
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.
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.
You can trigger custom action events from:
- Modifications (either from custom content or, if you're using a template, from the template content)
- Shared code
- Page code (meaning directly from your site source code)
If you're only triggering custom action events, and not displaying any content, use shared code instead of a modification.
Figure: Tracking custom actions by triggering a custom action event from shared code (click to enlarge)
When you trigger a custom action event:
- If the custom action does not exist in the database, meaning a custom action with the same name does not already exist in the database, the Frosmo Platform adds the event data (name and value) as a new custom action.
- If a custom action with the same name already exists in the database, and if that name is not already associated with the passed value, the Frosmo Platform adds the value to the existing custom action.
- If a custom action with the same name already exists in the database, and if that name is already associated with the passed value, the Frosmo Platform merely triggers the custom action event. The platform does not add any new event data to the database.
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:
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 Control Panel.
Value of the custom action. The value is case-sensitive.
This property maps to a Value field of a custom action in the Control Panel.
Custom action object examples
Testing custom action tracking
To test that custom actions are correctly tracked with the data layer:
- Go to the site.
- Enable console logging for Frosmo Core.
Go to a page where custom actions are tracked. If custom actions events are successfully triggered with the data layer, the browser console displays the following messages for each event:
EASY [events] info:: customAction(contains the custom action data parsed from the custom action object)
EASY [events] info:: customAction.<frosmoEvent>(contains the custom action data parsed from the custom action object)
EASY [events] info:: customAction.<frosmoEvent>.<frosmoValue>(contains the custom action data parsed from the custom action object)
EASY [events] info:: dataLayer(contains the custom action object passed to the data layer)
If the custom action has been enabled as a modification state in the Frosmo Control Panel, the browser console also displays the
EASY [events] info:: state.setmessage.
The following figure shows an example of the custom action event messages.
If you want more details on a data layer call, select the Network tab in the developer tools, and check the
customActionrequest to the Events API. If the status is
200, the request completed successfully.
Open the Frosmo Control Panel, select Utilities > Custom Actions, and check whether the tracked custom actions are listed with the passed values.
If you define titles for the custom action values in the Control Panel, the custom actions overview displays the titles rather than the values.