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.

PARAMETERTYPEDESCRIPTIONMANDATORY
userIDStringuser id is mandatory.Yes
event_nameStringName of the eventYes
ltvString Life Time Value (default value is 10)
attributesObjectCustom 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_paramsObject
user_params.nameStringName of user
user_params.emailStringEmail of user
user_params.mobileStringMobile of user
contextObject
context. ip_addressString IP address
context.pageObjectpage
context.page.urlString Page URL
context.page.referrerStringReferrer
context.page.query_paramsString Referrer URL
context.utmObjectQuery Params
context.utm.campaignString Campaign for the UTM source
utm.sourceStringUTM source
context.utm.mediumStringUTM Medium
context.utm.termStringUTM Term
context.utm.contentStringUTM Content
context.utm.google_click_idStringUTM google_click_id
event_timeStringDate and time when the event occurred in ISO format: yyyy-MM-ddTHH:mm:ss±hhmmfNo

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"
    }
}