Calling the Engine API

Context vs Events for Analytics

Information sent to Monetate generally falls into two categories:

  • Context — Session-derived data such as geographic and technographic information or custom variables
  • Events — Data used for calculating analytics and key performance indicators (KPIs)

Context is determined per session and can safely be sent multiple times—by both the Monetate tag and Engine API, for example—with no effect on analytics.

However, events can potentially be recorded by both the Monetate tag and Engine API in hybrid implementations. Be aware of the following factors:

  • API events are recorded at the session level for experience analytics, but you can view the aggregate count (how many times the event occurred) in raw data.
  • Product views are recorded individually but are only used for processing recommendation algorithms. What matters is if a product was viewed in a session, not how many times it was viewed.
  • Cart events are recorded as an event, and Monetate considers the most recent event for behavioral purposes. For this reason, even for traditional Monetate tag–based implementations, properly recording all applicable cart items on every track is important.
  • Purchases are recorded individually but are deduplicated by the purchaseId value. If a Monetate tag–based integration and Engine API integration report the same purchaseId value, then only one is recorded.

Page views aren't currently supported by the Engine API. As a result, average page views and bounce rate metrics cannot be calculated for Omnichannel experiences.

Custom Events

You can send any event, such as clicks and impressions, that falls outside of Monetate's built-in events by using monetate:record:PageEvents.

Example Request with monetate:record:PageEvents


The list of events sent can be any event configured in Monetate by following the steps in Creating a Custom Engine API Event. These events are identified in the API by their Unique Key, an alphanumeric string set when you create the event.

You can't use monetate:record:PageEvents to send an event that doesn't have a Unique Key.

You can configure any event to have a Unique Key. Requests referencing this key from the time the key is set result in that event being sent to Monetate. When one or more of these events are sent via the Engine API, they're recorded within Monetate as having occurred for the customer at the time sent. For example, in the example monetate:record:PageEvents request, an event with the Unique Key myEvent is sent. This value was set using the Unique Key field in the Create Engine API Event modal in the Monetate platform.

A number of rules govern how Unique Keys function:

  • Each key must be unique and can only be used if it actively references the event in question.
  • You can't set a key retroactively but you can change it. If you send a Unique Key in a monetate:record:PageEvents request before you create the key, then the Unique Key is ignored.
  • The Engine API also ignores any Unique Key value in a request that no longer references an event, such as when an Unique Key is changed.

Custom events are useful for reporting and for use as goal metrics in Monetate experiences.

Creating a Custom Engine API Event

Follow these steps to create a custom Engine API event in the Monetate platform.

  1. Log into the Monetate platform.
  2. Click COMPONENTS in the top navigation bar and then select Events.

    Callout of the Events option in the COMPONENTS menu of the Monetate platform
    
  3. Click the arrow to the right of CREATE EVENT and then select Create Engine API Event.

    Callout of the 'Create Engine API Event' option in the 'CREATE EVENT' selector
    
  4. In the Create Engine API Event modal, give the event a title and description, then enter into Unique Key the value to be sent when this event occurs. Leave API as the selected option for Category. Optionally, enter a subcategory and any action conditions.

    The Create Engine API Event modal
    
  5. Click SAVE.

Monetate recommends creating one or more action conditions to limit the event to pages on which it should be tracked.

When a customer meets the criteria of the event, send a request with monetate:record:PageEvents that contains the Unique Key that you input for the custom event.

You also must add the custom API event to the WHY settings of an Omnichannel experience as a secondary metric. Follow steps 5 and 6 in Add Custom Metrics to an Experience to add and select the event in the Monetate platform's Experience Editor.