Pages

To create a trigger:

  1. In the Frosmo Control Panel, select Triggers.
  2. Click Create trigger.
  3. Enter a descriptive name for the trigger.
  4. Define the evaluation point for the trigger.
  5. Optionally, define the rules for firing the trigger. If you define no rules, the trigger is fired every time the trigger event, as defined by the evaluation point, takes place.
  6. Optionally, define an alias for the trigger.
  7. When you're done, click Save.

After creating the trigger, you have several options for managing it.

To get started with a simple example, create a trigger based on a page URL. For more complex trigger use cases, see Using triggers.

Evaluation point

An evaluation point is the event on a web page that causes the Frosmo Platform to check whether to fire the trigger. The following table lists the events supported by the platform.

Table: Supported trigger events

EventOptionsDescription
Core eventEvent

A specific Frosmo Core event has occurred.

If you select this event, also define the event type. You can select from the following event types:

  • Conversion
  • Frosmo custom action
  • Modification display
  • Modification click
  • Modification true display
  • Session start
  • Other predefined event
  • Product purchase
  • Visitor location change

If you select Other predefined event, enter the name of the event. The trigger is fired only when the event has been triggered with the frosmo.easy.events.trigger('name') function.

Data layer event

Data has been pushed to the data layer.

Every dataLayer.push() call on a page triggers this event.

DOM element ready

Element

Timeout (seconds)

A specific DOM element has been loaded and parsed, and is ready to be manipulated.

If you select this event, also define the element whose readiness fires the trigger and, optionally, the timeout (in seconds) after which the Frosmo Platform stops trying to fire the trigger. Define the element using a CSS selector; jQuery selectors are not supported. If you define no timeout, the platform keeps trying indefinitely.

DOM event

Event

Element

A specific DOM event has occurred.

If you select this event, also define the event type and the element (as a CSS selector) to which the event must happen. You can select from the following event types:

  • Click
  • Key down
  • Key press
  • Key up
  • Submit

For example, to fire the trigger on a link click, select Click as the event type, and define the element with the CSS selector "a".

DOM ready
All DOM elements have been loaded and parsed, and are ready to be manipulated.
Frosmo script loaded

Frosmo Core has been loaded and is ready to be initialized.

At this point, some DOM elements may not yet be available.

Frosmo script ready

Frosmo Core has been initialized.

Frosmo context data (visitor data stored in frosmo.easy.context) has been loaded, segmentation has taken place, and the Frosmo custom script can now be initialized.

At this point, some DOM elements may not yet be available.

JavaScript variable ready

Variable

Timeout (seconds)

A specific JavaScript variable defined in the window object has been loaded and is ready to be manipulated.

If you select this event, also define the variable name and, optionally, the timeout (in seconds) after which the Frosmo Platform stops trying to fire the trigger. If you define no timeout, the platform keeps trying indefinitely.

If you need to check the value of a nested object property, add a JavaScript variable rule to the trigger, and define the nested object property as the variable using dot notation (for example, object.object.property).

URL change

A URL change through the hashchange or popstate event has occurred.

The URL change event is supported only for single-page applications and works only for as long as there is no new page load.

To use the URL change event, single-page application support must be enabled in the Frosmo custom script.

For more information about the hashchange and popstate events, see hashchange event and popstate event at MDN.

Rules

Define the rules for firing the trigger. If you define no rules, the trigger is fired every time the trigger event, as defined by the evaluation point, takes place.

The Frosmo Platform supports the following rules:

The trigger is fired based on the value stored in a cookie. You can get the value by cookie name.

Example

The trigger is fired when the Frosmo script is loaded on the page and the value of the frosmo_keywords cookie contains the target group tggp_232.

DOM element

The trigger is fired if there is a specific DOM element on the page. To define the element, add a CSS selector and an attribute or property identifying the element:

  • If the value in the field has the prefix prop:, the element's property must match.
  • If the value in the field has the prefix attr:, the element's attribute must match.
  • If there is no prefix, the system first tries to match properties and then attributes.
Example

The trigger is fired when a conversion occurs and the textContent value of the discount.campaign-code DOM element is outdoor. This can mean, for example, that a visitor purchases an item in an outdoor discount campaign and, as a result, a relevant modification is shown to the visitor.

Event data

The trigger is fired based on data passed by a predefined event. Specifically, the rule checks whether the value of an event data property matches a value you provide.

This rule is available only for the following evaluation points:

  • Core event
  • Data layer event
  • DOM element ready
  • DOM event
  • URL change

The available properties on which to base the rule depend on the selected evaluation point and, in some cases, the selected event type. Depending on your selection, you either select the property from a list of predefined properties or manually define the property name.

The following table lists the available properties based on the selected evaluation point and, if relevant, event type.

Table: Available event data properties based on evaluation point and event type

Evaluation pointEvent typeEvent data properties
Core eventConversion
  • Conversion ID
  • Conversion type
Frosmo custom action
  • Custom action name
  • Custom action value
Modification display/click/true display
  • Modification ID
  • Variation ID
  • Variation type
  • Variation content
Other predefined eventDepends on the event data.
Product purchase
  • Product ID
  • Product value
Visitor location change
  • Country
  • IP address
  • Latitude
  • Longitude
Data layer eventAnyDepends on the event data.
DOM element readyAny
  • Element ID
  • Element classes
  • Element HTML
  • Element text
  • Element property
DOM eventAny
  • Element ID
  • Element classes
  • Element HTML
  • Element text
  • Element property
URL changeAny
  • Current URL
  • Previous URL
Example

The trigger is fired when a click is registered for a modification with the ID 12345.

If multiple event data arguments are passed to the triggered event using the frosmo.easy.events.trigger() function, only the first argument is registered.

JavaScript code

The trigger is fired based on your own JavaScript code. The code must return a value to be matched.

If the return value is Boolean (true or false), you must stringify the value.

Example

The trigger is fired when the page DOM is ready to be manipulated and the visitor is using a desktop device.

JavaScript variable

The trigger is fired based on a JavaScript variable value on the page. The variable must be available on the window object.

If you need to check the value of a nested object property on the page, use dot notation to reference the property, for example, object.object.property.

Example

The trigger is fired when the page DOM is ready to be manipulated, and a JavaScript variable named productBrand with the value Frosmo exists on the page.

Local storage

The trigger is fired based on data stored in local storage. You can get the data by the key name.

Example

The trigger is fired when the page DOM is ready to be manipulated, and the value of the phoneNumber local storage item begins with 09. This can help you, for example, to target visitors in a certain geographical area.

Page referrer

The trigger is fired when the visitor arrives from a specific page.

You can define the page based on:

  • URL: Matches the exact URL of the page. For example: http://www.example.com/index.html
  • Protocol: Matches the HTTP or HTTPS part of the URL.
  • Domain: Matches the part after the protocol. For example, in the URL http://www.example.com/index.html, the domain is www.example.com.
  • Path: Matches the URL path after the domain. For example, in the URL http://www.example.com/index.html, the path is /index.html.
  • Anchor: Matches any part of the URL that comes after the "#" character.
  • Query selector: Matches any part or the URL that comes after the "?" character. If the query parameter is defined, it will only match a single parameter. For example, in the URL http://example.com/?search=word&count=10, the complete query parameters are search=word&count=10, and the query key for search is word.
Example

The trigger is fired when a new site visitor enters the page from a page with a domain containing the string /facebook/.

Page URL

The trigger is fired on a specific page.

You can define the page based on:

  • URL: Matches the exact URL of the page. For example: http://www.example.com/index.html
  • Protocol: Matches the HTTP or HTTPS part of the URL.
  • Domain: Matches the part after the protocol. For example, in the URL http://www.example.com/index.html, the domain is www.example.com.
  • Path: Matches the URL path after the domain. For example, in the URL http://www.example.com/index.html, the path is /index.html.
  • Anchor: Matches any part of the URL that comes after the "#" character.
  • Query selector: Matches any part or the URL that comes after the "?" character. If the query parameter is defined, it will only match a single parameter. For example, in the URL http://example.com/?search=word&count=10, the complete query parameters are search=word&count=10, and the query key for search is word.

For an example of how to use the Page URL rule, see Creating a trigger based on the page URL.

Alias

You can define an alias for a trigger. You can use the alias to bind a JavaScript function to the trigger. For example, use the following code to bind an alias named "myTriggerAlias" to a trigger:

frosmo.easy.events.on('myTriggerAlias', function (trigger) {...});

The bound function will be called every time the trigger fires. The function receives the trigger object as an argument. If you want to call the bound function once, use the frosmo.easy.events.once() function.

Example: Creating a trigger based on a page URL

This example shows you how to create a trigger based on a page URL. You can use triggers like this to, for example, segment visitors based on the pages they have viewed. By recognizing customers who are interested in a specific product, you can recommend relevant products to them.

For more complex trigger implementations, see Using triggers.

To segment visitors based on the trigger, you must also create a segment using the trigger as a segmentation rule. For more information, see the segmentation rules section in Segmentation User Guide.

You can also use this trigger in modification placements to define when to show a modification. For more information, see the placements section in Creating visitor journeys.

In this example, you fire the trigger when the visitor views product pages in the "outdoor" product category. The web site has been implemented so that for product pages in that category, the URL path contains the string /outdoor/.

To create the trigger:

  1. In the Frosmo Control Panel, select Triggers.
  2. Click Create trigger.
  3. Enter the trigger name as "Outdoor category".
  4. In Evaluation point, select Frosmo script loaded. This means that the trigger is evaluated once the Frosmo script has been loaded on the page.
  5. Click Add new rule, click Page URL, and set the trigger rule:

    Page path begins with /outdoor/.


    This means that the trigger is fired when the visitor views a product page in the "outdoor" category (once the Frosmo script has been loaded on the page).

    Creating a trigger based on a page URL

  6. When you're done, click Save.
  • No labels