Customizing events with key-value pairs

At times you may want to augment a standard event with additional properties or metadata to support predictive modeling or to enrich reporting. These additional properties can be included as key-value pairs when logging custom events using the Medio.Events.logEvent method. It’s best to contact your sales representative when using new key-value pairs to ensure they will be used as intended.

For example, with a Purchase event you may want to log the profit margin of a Purchase (in addition to the price of the item) as a key-value pair:

Medio.Events.logEvent({
   event_name: "Purchase",
   action_type: "Purchase",
   unit_price: "9.99", 
   currency: "USD",
   quantity: "1",
   item_id: "3312345",
   item_category_tag: "Add 1G to Data Plan",
   profit_margin: "2.00"
});

Note that if the key name were profit.margin instead of profit_margin, it would need to be wrapped in a pair of quotes as in "profit.margin": "2.00".

Here is a list of standard, but optional key-value pairs that can be used to augment standard events:

key definition
placement id representing the location of an offer on a page
product_name the name of the client application
product_version the version of the client application
product_version_code the version code of the client application

Custom event names

You can log custom events in your application using the JavaScript SDK’s Medio.Events.logEvent method. The Medio NEXT dashboard will automatically report on event counts for every event_name. Contact your sales representative when using new values for event_name to ensure they will be used as intended.

As an example, you might want to log a custom event for a special type of offer conversion on third-party offers. This might look like:

Medio.Events.logEvent({
   event_name: "Conversion_ThirdPartyOffer",
   content_type: "offer",
   item_id: "3312345",
   unit_price: "9.99", 
   currency: "USD"
});