Event Format
Metarank expects to receive a predefined set of events, describing visitor activity and item metadata:
Item metadata events. They describe what should be known about items.
User metadata events. They describe what we may know about visitors.
Ranking events. What was presented to the visitor.
Interaction events. What visitor did with the ranking (clicks, likes, purchases).
Event format
Metarank expects to receive these events in JSON format for simplicity. There is also a plan to add support for protobuf in some future version. Each event has a couple of shared required fields:
id - which is a unique identifier for the event, should be generated by your app
timestamp - number of milliseconds from 1970-01-01T00:00:00 (see timestamp format description on which formats are supported)
event - one of
item
/user
/ranking
/interaction
values.
There is also a shared optional "tenant" field for multi-tenancy cases.
fields
parameter
fields
parameterfields
parameter is used in all events, however it is optional for ranking and interaction events. You can provide some additional context, like a search query, selected filters or shipping data that can be used as features of your personalization model.
fields.name
: name of the field. fields.value
: can be any of the following types:
boolean
string
number
list of strings
list of numbers
Item metadata event
Metadata event is used to provide Metarank with updates of your content items (new items added, updates of values for existing items). You don't need to pass all values that your items have; only the ones that you might use as your personalization model features.
Event format
id
: event id.item
: id of the content item.fields
: an array of content item properties, see event fields chapter for details.
User metadata event
User metadata is useful when you have some extra knowledge about your visitor. For example, if visitor filled a signup form, it could be gender or age.
Event format
id
: event id. This field is not yet used, but the value must be provided at the moment.user
: id of the visitor.fields
: an array of content item properties, see event fields chapter for details.
Ranking event
Ranking event is used to indicate what items and in what order are shown to a visitor. This information is used by personalization algorithms to understand which items are relevant for the visitor.
Event format
id
: a request identifier later used to join ranking and interaction events. Should match the value that is sent to the Ranking API.user
: an optional unique visitor identifier.session
: an optional session identifier, a single visitor may have multiple sessions.fields
: an optional array of extra fields that you can use in your model, as described above.items
: which particular items were displayed to the visitor.items.id
: id of the content item. Should match theitem
property from metadata event.items.fields
: a set of optional per-item fields.items.label
: an optional field for explicit relevance judgments.
Interaction event
Interaction event identifies which actions the visitor performed on the items displayed. Some of the example of such events are: click, like, purchase. The type
field must match the name
provided in the Configuration.
Event format
id
: a request identifier.ranking
: an optional identifier of the parent ranking event. Some interactions may happen outside of the ranking event (for example, likes happened on an item page), so it can be legally empty.user
: an optional unique visitor identifier.session
: an optional session identifier, a single visitor may have multiple sessions.type
: internal name of the event.item
: id of the content item. Should match theitem
property from metadata event.fields
: an optional array of extra fields that you can use in your model, as described above.
Last updated