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:
1
{
2
"$ts": 3489009384393,
3
"$event_name": "$transaction_confirmed", // Conversion detected
4
"$properties": {
5
"$items": [
6
{
7
"$id": "product_ID", // Used to filter in funnel analytics
8
"$qty": 20, // Used for conversion amounts
9
"$price": 102.8, // Used or conversion amounts
10
"$brand": "Apple" // Used to filter in funnel analytics
11
"$category1": "Category 1", // Used to filter in funnel analytics
12
"$category2": "Category 2", // Used to filter in funnel analytics
13
"$category3": "Category 3", // Used to filter in funnel analytics
14
"$category4": "Category 4" // Used to filter in funnel analytics
15
},
16
{
17
"$id": "product_ID2",
18
"$qty": 12,
19
"$price": 3.4,
20
"$brand": "Microsoft"
21
}
22
],
23
"$currency": "EUR"
24
}
25
}
Copied!
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 retention

Activities analytics data is kept 4 month in order to optimize performances.

Transforming important events into your custom events

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.

Event transformations

An event transformation is linked to a datamart. Here is a sample transformation:
1
{
2
"id": 15, // Read only
3
"datamart_id": "3333", // Read only
4
"created_ts": <>, // Read only
5
"created_by": <>, // Read only
6
"last_modified_by": <>, // Read only
7
"last_modified_ts": <>, // Read only
8
9
"channel_id": "8888",
10
"source_event_name": "order",
11
"target_event_name": "$transaction_confirmed",
12
"mapping_id": 15
13
}
Copied!
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 :
  • $transaction_confirmed
  • $item_view
  • $basket_view
  • $list_item_view
To learn about predefined events, see Predefined event names
mapping_id
Integer
The ID of the Property mapping to apply when transforming the event

Property mappings

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.
1
// Comments are here to help you understand,
2
// remove them before uploading mappings as they are not accepted in JSON
3
{
4
"id": 17, // Read only
5
"created_by": <>, // Read only
6
"created_ts": <>, // Read only
7
"mapping": {
8
"values": [
9
{
10
// Maps $properties.order.order_products to $items
11
"target_attribute_name": "$items",
12
"source_attribute_path": {
13
"attribute_name": "$properties",
14
"sub_path": {
15
"attribute_name": "order",
16
"sub_path": {
17
"attribute_name": "order_products"
18
}
19
}
20
},
21
// Maps $properties.order.order_products.xxx to $items.xxx
22
23
// You can't use other target attributes than the ones
24
// in this example.
25
// But they are not all mandatory : a non used target
26
// attribute will use the default value
27
"children": [
28
// $properties.order.order_products.product.id
29
// becomes $items.$id
30
// to be used by analytics database
31
{
32
"target_attribute_name": "$id",
33
"source_attribute_path": {
34
"attribute_name": "product",
35
"sub_path": {
36
"attribute_name": "id"
37
}
38
}
39
},
40
// $properties.order.order_products.qty
41
// becomes $items.$qty
42
// to be used by analytics database
43
{
44
"target_attribute_name": "$qty",
45
"source_attribute_path": {
46
"attribute_name": "qty"
47
}
48
},
49
{
50
"target_attribute_name": "$price",
51
"source_attribute_path": {
52
"attribute_name": "price"
53
}
54
},
55
{
56
"target_attribute_name": "$ean",
57
"source_attribute_path": {
58
"attribute_name": "ean",
59
}
60
},
61
{
62
"target_attribute_name": "$brand",
63
"source_attribute_path": {
64
"attribute_name": "brand",
65
}
66
},
67
{
68
"target_attribute_name": "$category1",
69
"source_attribute_path": {
70
"attribute_name": "cat1"
71
}
72
},
73
{
74
"target_attribute_name": "$category2",
75
"source_attribute_path": {
76
"attribute_name": "cat2",
77
}
78
},
79
{
80
"target_attribute_name": "$category3",
81
"source_attribute_path": {
82
"attribute_name": "cat3"
83
}
84
},
85
{
86
"target_attribute_name": "$category4",
87
"source_attribute_path": {
88
"attribute_name": "cat4"
89
}
90
}
91
]
92
}
93
]
94
}
95
}
Copied!
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