Activities analytics
Data coming into your datamart is stored in a multi-model database, optimizing it for different usages. To display performance analytics for elements like session duration, conversions, and funnel, the platform duplicates some user activities and information and optimizes them.
For that purpose, it is important that you use predefined event names and properties when possible. Custom events won't be taken into account when calculating metrics. For example, don't create
order
events when tracking an e-commerce site, but the predefined $transaction_confirmed
event. $transaction_confirmed
events are used when calculating conversions and amounts but not order
events.Here is a sample event that can be used in analytics:
{
"$ts": 3489009384393,
"$event_name": "$transaction_confirmed", // Conversion detected
"$properties": {
"$items": [
{
"$id": "product_ID", // Used to filter in funnel analytics
"$qty": 20, // Used for conversion amounts
"$price": 102.8, // Used or conversion amounts
"$brand": "Apple" // Used to filter in funnel analytics
"$category1": "Category 1", // Used to filter in funnel analytics
"$category2": "Category 2", // Used to filter in funnel analytics
"$category3": "Category 3", // Used to filter in funnel analytics
"$category4": "Category 4" // Used to filter in funnel analytics
},
{
"$id": "product_ID2",
"$qty": 12,
"$price": 3.4,
"$brand": "Microsoft"
}
],
"$currency": "EUR"
}
}
The list of predefined events that are used in analytics are as follows.
Event name | Usage | Important properties |
$transaction_confirmed | Home dashboards (E-Commerce Engagement)
Segment dashboards (E-Commerce Engagement)
Funnel Analytics | $items : list of products in the transaction
$items.$qty : for the conversion amounts
$items.$price : for the conversion amounts
$items.$id : for the product IDs in funnel analytics
$items.$brand : for the brand filter in funnel analytics
$items.$category1 , $items.$category2 , $items.$category3 and $items.$category4 : for the categorization in funnel analytics |
$item_view | Funnel Analytics | $items : contains only one product
$items.$price : for the conversion amounts
$items.$id : for the product IDs in funnel analytics
$items.$brand : for the brand filter in funnel analytics
$items.$category1 , $items.$category2 , $items.$category3 and $items.$category4 : for the categorization in funnel analytics |
$basket_view | Funnel Analytics | $items : list of products in the basket
$items.$qty : for the conversion amounts
$items.$price : for the conversion amounts
$items.$id : for the product IDs in funnel analytics
$items.$brand : for the brand filter in funnel analytics
$items.$category1 , $items.$category2 , $items.$category3 and $items.$category4 : for the categorization in funnel analytics |
Activities analytics data is kept 4 month in order to optimize performances.
While it is better to use predefined events when possible, it isn't always the best solution for you. To keep having analytics correctly stored, you can transform your custom events to predefined ones.
Only events coming into the datamart after an event transformation has been defined will be transformed.
Those transformations don't transform user activities and events anywhere else. You should use activity analyzers to transform them everywhere.
An event transformation is linked to a datamart. Here is a sample transformation:
{
"id": 15, // Read only
"datamart_id": "3333", // Read only
"created_ts": <>, // Read only
"created_by": <>, // Read only
"last_modified_by": <>, // Read only
"last_modified_ts": <>, // Read only
"channel_id": "8888",
"source_event_name": "order",
"target_event_name": "$transaction_confirmed",
"mapping_id": 15
}
Property | Type | Description |
datamart_id | Integer | The ID of the datamart where the transformation is applied |
channel_id | Integer | The ID of the channel where the transformation is applied |
source_event_name | String | The name of your custom event you wish to transform into a predefined event |
target_event_name | String | The name of the predefined event it is transformed into. Allowed values are :
|
mapping_id | Integer |
Event transformations use property mappings to choose which property in your custom event becomes which property in the predefined event.
Here is a sample property mapping to start with for
$transaction_confirmed
events.// Comments are here to help you understand,
// remove them before uploading mappings as they are not accepted in JSON
{
"id": 17, // Read only
"created_by": <>, // Read only
"created_ts": <>, // Read only
"mapping": {
"values": [
{
// Maps $properties.order.order_products[] to $items[]
"target_attribute_name": "$items",
"source_attribute_path": {
"attribute_name": "$properties",
"sub_path": {
"attribute_name": "order",
"sub_path": {
"attribute_name": "order_products"
}
}
},
// Alternative : mapping directly $properties if there are no multiple
// elements in the event. It will be treated as an array of only one item
"target_attribute_name": "$items",
"source_attribute_path": {
"attribute_name": "$properties"
},
// Maps $properties.order.order_products.xxx to $items.xxx
// You can't use other target attributes than the ones
// in this example.
// But they are not all mandatory : a non used target
// attribute will use the default value
"children": [
// $properties.order.order_products.product.id
// becomes $items.$id
// to be used by analytics database
{
"target_attribute_name": "$id",
"source_attribute_path": {
"attribute_name": "product",
"sub_path": {
"attribute_name": "id"
}
}
},
// $properties.order.order_products.qty
// becomes $items.$qty
// to be used by analytics database
{
"target_attribute_name": "$qty",
"source_attribute_path": {
"attribute_name": "qty"
}
},
{
"target_attribute_name": "$price",
"source_attribute_path": {
"attribute_name": "price"
}
},
{
"target_attribute_name": "$ean",
"source_attribute_path": {
"attribute_name": "ean",
}
},
{
"target_attribute_name": "$brand",
"source_attribute_path": {
"attribute_name": "brand",
}
},
{
"target_attribute_name": "$category1",
"source_attribute_path": {
"attribute_name": "cat1"
}
},
{
// In this example $category2 will be
// event.$event_name instead of
// $properties.order.order_products[].$event_name
// thanks to absolute_path
"target_attribute_name": "$category2",
"source_attribute_path": {
"absolute_path": true,
"attribute_name": "$event_name",
}
},
{
"target_attribute_name": "$category3",
"source_attribute_path": {
"attribute_name": "cat3"
}
},
{
"target_attribute_name": "$category4",
"source_attribute_path": {
"attribute_name": "cat4"
}
}
]
}
]
}
}
Map events JSON as it is stored in the database and visible in user's timelines (post activity analyzers).
get
https://api.mediarithmics.com
/v1/datamarts/:datamartId/analytics_event_transformation
Get existing transformations
post
https://api.mediarithmics.com
/v1/datamarts/:datamartId/analytics_event_transformation
Create an event transformation
put
https://api.mediarithmics.com
/v1/datamarts/:datamartId/analytics_event_transformation/:transformationId
Update an event transformation
delete
https://api.mediarithmics.com
/v1/datamarts/:datamartId/analytics_event_transformation/:transformationId
Remove an event transformation
get
https://api.mediarithmics.com
/v1/datamarts/:datamartId/analytics_mapping
Get property mappings
post
https://api.mediarithmics.com
/v1/datamarts/:datamartId/analytics_mapping
Create property mappings
delete
https://api.mediarithmics.com
/v1/datamarts/:datamartId/analytics_mapping/:mappingId
Delete property mappings
Last modified 11mo ago