Logging content events

The JavaScript SDK automatically logs a PageLoad event with a url every time the SDK finishes loading into the current page.  Medio also defines specific content events for specific user behaviors such as a user viewing or clicking on a piece of content. Below is the list of standard Medio content events.

Requirements for content events:

  • The content_type for an Offer or a Recommendation must be set to “offer” or “rec”.
  • For content retrieved from the Content Recommendation API, the item_id should match the id received from the API.
  • The action_type field is required to be a duplicate of the event_name field.

ShownContent

Description: Content was sent to the customer for display.

Example:

Medio.Events.logEvent({
   event_name: "ShownContent",
   action_type: "ShownContent",
   content_type: "offer",
   item_id: "1234567"
});

Required Attributes:

  • action_type, item_id, content_type

ViewedContent

Description: Stronger than ShownContent, ViewedContent indicates that a user most likely viewed the item. Customers may use any method they prefer for determining a ViewedContent event.

Example:

Medio.Events.logEvent({
   event_name: "ViewedContent", 
   action_type: "ViewedContent", 
   item_id: "ABCD1234",
   content_type: "rec", 
   page_name: "home",
   placement: "top",
   item_description: "Description for Product ABCD1234", 
   item_category_tag: "Category for Product ABCD1234",
   unit_price: "150.00"
});

Required Attributes:

  • action_type, item_id, content_type

ClickedContent

Description: Item was clicked on by the user.

The Content API automatically generates ClickedContent events when items are clicked, so no client-side instrumentation is needed.

AcceptContent

Description: Item (likely an offer) was accepted by the user.

Example:

Medio.Events.logEvent({
   event_name: "AcceptContent", 
   action_type: "AcceptContent", 
   item_id: "AAA-BBB-CCC-000", 
   content_type: "offer" 
});

Required Attributes:

  • action_type, item_id, content_type

DeclineContent

Description: Item (likely an offer) was declined by the user.

Example:

Medio.Events.logEvent({
   event_name: "DeclineContent", 
   action_type: "DeclineContent", 
   item_id: "AAA-BBB-CCC-000", 
   content_type: "offer" 
});

Required Attributes:

  • action_type, item_id, content_type

RepliedContent

Description: A text message was sent by a user in response to an offer.

Example:

Medio.Events.logEvent({
   event_name: "RepliedContent", 
   action_type: "RepliedContent", 
   item_id: "AAA-BBB-CCC-000", 
   content_type: "offer",
   user_reply_data: "I rate this offer 5 Stars!" 
});

Required Attributes:

  • action_type, item_id, content_type