Tracking for basic custom actions can be implemented as follows:
- In the Frosmo custom script using custom code. This type of tracking is always implemented by Frosmo developers. If you do not implement the tracking yourself, Frosmo developers do it for you through your site's custom script.
- In modification content using Frosmo Core. This type of tracking is also implemented by Frosmo developers, since it requires knowledge of the Frosmo Core library. Triggering custom actions from a modification can be a useful alternative to triggering them from custom code, but even here part of the tracking is usually implemented in custom code.
- In the site code or in modification content using the Frosmo data layer. If you want to implement the tracking yourself, use the data layer to trigger custom actions directly from your site code or from modification content. The following instructions only cover this solution for basic custom actions.
Basic custom actions can be triggered with predefined values, which you write into the tracking code, or they can get their values from a variable, meaning you don't need to know the values beforehand.
To track visitor geolocation with custom actions, simply create those actions in the Frosmo Control Panel. You can do this yourself or Frosmo can do it for you.
In this topic:
Tracking custom actions with the data layer
Before you can use the data layer with the Frosmo Platform, you must enable the data layer module for your site.
Tracking a basic custom action with the data layer means calling the
dataLayer.push() function with the custom action name and a value at every point in the site code where a visitor can complete the tracked action. The function triggers the custom action event and sends the name and value to the Frosmo back end.
For instructions and examples on tracking basic custom actions, see Tracking custom actions with the data layer.
Once you have the tracking in place, you can use the custom action to implement other features.
Tracking visitor geolocation
Before you can use geolocation custom actions on your site, you must enable the Geolocation module for the site. If the module is disabled, you cannot create geolocation custom actions for the site. If the module is enabled and you disable it, any existing geolocation custom actions on the site will stop working.
A geolocation custom action tracks a visitor's real-world geographic location. Frosmo Core handles the tracking logic and automatically triggers the custom action on page load when the visitor's current location matches one of the geolocation values defined for the custom action.
Geolocation custom actions only work on desktop devices (including laptop computers).
To track visitor geolocation with a custom action:
- In the Frosmo Control Panel, select Utilities > Custom Actions.
- Click Create custom action.
Define the basic information:
- Name: Enter a name for the custom action.
- Description: Optionally, enter a description for the custom action.
- Use as a state: Keep this feature disabled, since you cannot use geolocation custom actions as states in modifications.
Select Values, and define the geographic locations you want to track:
- Select Geolocation.
- Enter a Title for the location, and define the location either by entering its Latitude, Longitude, and Radius, or by clicking show map and drawing the location on the map. To hide the map, click show map again.
- To add another location, click Add another value, and repeat from the preceding step.
- Click Save.
You can now use the custom action to implement other features.