Parameters
The Event object
The Event object represents the event being tracked for a given Custom User ID. You can enrich events to pass any relevant data, which will be later used to trigger personalized messages.
Id | Description | |
---|---|---|
name | string - Required Event name E.g. {"name":"ue.added_to_cart"} | |
time | Date - Optional The time date and time an event occurred. It has to respect YYYY-MM-ddTHH:mm:ss format. You can track events that happened in the last 24 hours, and no events in the future. If this parameter is not included in your request, Batch will use the time the event arrives at the server. E.g. {"time":"2012-08-12T22:30:05"} | |
label | String - Optional The event label (up to 200 characters). E.g. {"label":"shoes"} | |
attributes | Object - Optional An object containing all attributes you would like to attach to the event (up to 15 attributes). E.g. {"attributes":{"sub_category":"boots"}} | |
tags | Array - Optional An array containing all tags to attach to the event (up to 10 tags, maximum 64 chars per tag). E.g. {"tags":["private-sales","summer-discount"]} |
If limits are not respected, an error will be returned.
The attributes object
You can attach up to 15 attributes to an event sent with the Trigger Events API.
Naming
Attribute names are strings. They should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters (e.g. "sub_category").
Values
Values can be any of the following type:
- string: up to 64 characters, e.g.
{"sub_category": "shoes"}
- integer: up to 64 characters, e.g.
{"level": 23}
- boolean: e.g.
{"is_premium": true}
- float: e.g.
{"level_progress": 45.09}
Additional types
Date
We support dates, unfortunately JSON does not, thus we need extra information to know an attribute is actually a date.
We do this via wrapping the key name in the date()
function.
{
"date(promo_starts)": 1451642400,
"date(promo_ends)": "2021-01-01T04:00:00.000"
}
If you're using date()
on a string, be sure to use the format YYYY-MM-ddTHH:mm:ss. Be aware that we will interpret the date as UTC in both cases.
URL
URL type is also supported. You will need to wrap the key name in the url()
function.
{
"url(product_image)": "https://batchstore/product/4729/image.png",
"url(product_deeplink)": "myapp://path/to/content"
}
You need to provide a valid URL, in the limit of 2048 characters:
- A scheme is compulsory (
myapp://
,https://
...) ://
is compulsory after the scheme
If the URL provided isn't valid, the API call will fail.