NotifyVisitors offers an API for tracking events once you integrate your platforms through the SDK, it begins tracking the events. These are called system events. NotifyVisitors tracks user interactions with your apps and campaigns.
Apart from the system events, you can create custom events to track the other interactions of the users which are vital for your business. These created custom events are defined by the event attributes such as the price of the product, quantity, category, etc. Such type of data is used to engage customers via personalized campaigns across all engagement channels.
API Endpoints For Tracking Events
NotifyVisitors provides different API endpoints for tracking the custom and system events.
Track Events
- This endpoint enables you to create or update events. You can upload a maximum of 1000 users at a single API.
https://analytics.notifyvisitors.com/api/v1/event/create
Event Attributes Example Data
Refer to the below example for the same
{
"nv":[{
"userID":"9820301062",
"event_name":"Order Placed",
"ltv":"10",
"attributes":{
"product_name":"Test Product",
"order_id":12345,
"total_amount":100
},
"user_params": {
"name": "Michael Smith",
"email": "[email protected]",
"mobile": "+551155256325"
},
"context":{
"ip_address":"",
"page":{
"url":"https://www.example.com",
"referrer":"https://www.google.com",
"query_params":"tracking=yes&code=xxxxxx"
},
"utm":{
"campaign":"",
"source":"",
"medium":"",
"term":"",
"content":"",
"google_click_id":""
}
},
"event_time":"2022-03-27 04:08:18"
}]
}
Note:
You can select parameters from the given table on the right to send event attributes in request body.
Points to Remember
-
The name of the custom events must be less than 50 characters.
-
The names of the custom events are case sensitive. The string attribute values of the custom events must be less than 1000 characters.
-
Event attributes have the following data types: String, Number, Boolean, Date,JSON Array,JSON object. Remember that JSON objects can contain only one of these data types.
-
In case, the event attribute value is in a JSON object, it cannot be used to create segments. You can only use it to create personalized campaigns.
-
The data types must have consistent values that you can save against the attribute. If the data type is changed in the future, the custom event attribute data will not flow steadily in the NotifyVisitors dashboard.
PARAMETER | TYPE | DESCRIPTION | MANDATORY |
---|---|---|---|
userID | String | user id is mandatory. | Yes |
event_name | String | Name of the event | Yes |
ltv | String | Life Time Value (default value is 10) | |
attributes | Object | Custom attributes of the user as key-value pairs or arrays. For example: { "product_name":"Test Product", "order_id":12345, "total_amount":100 } These data types are allowed for custom attributes: String, Number, Boolean, Date, JSON Object. JSON Object can contain one of these data types. | Yes |
user_params | Object | ||
user_params.name | String | Name of user | |
user_params.email | String | Email of user | |
user_params.mobile | String | Mobile of user | |
context | Object | ||
context. ip_address | String | IP address | |
context.page | Object | page | |
context.page.url | String | Page URL | |
context.page.referrer | String | Referrer | |
context.page.query_params | String | Referrer URL | |
context.utm | Object | Query Params | |
context.utm.campaign | String | Campaign for the UTM source | |
utm.source | String | UTM source | |
context.utm.medium | String | UTM Medium | |
context.utm.term | String | UTM Term | |
context.utm.content | String | UTM Content | |
context.utm.google_click_id | String | UTM google_click_id | |
event_time | String | Date and time when the event occurred in ISO format: yyyy-MM-ddTHH:mm:ss±hhmmf | No |
API Response
While you call an API for receiving and sending data to track the custom events, you can be shown the below response. The status can be shown as queued, error, or success.
{
"response": {
"status": "queued"
}
}
Errors
If you do not pass the necessary information in the event attributes, then an error message will be displayed :
{
"response": {
"message":"Error: userId can not be empty.",
"status":"error"
}
}