Tracking Events

Import NotifyVisitors package

import Notifyvisitors from react-native-notifyvisitors';

Tracking Events

Notifyvisitors.event((String)eventName, (JSONObject)attributes, (String)ltv, (String)scope, callback);

For example,

let attributes = {
  "name":"john",
  "number":"98987XXXXX",
  "user_score":"340",
  "plan_type":31
};

Notifyvisitors.event("my_event",attributes, "7","2", (result) => {
    //do your task here
});

This callback will provide you with a response in the following format-

{
   "status":"success",
   "eventName":"app_launch",
   "message":"Tracking Conversion successful for app_launch.",
   "type":0,
   "callbackType":"event"
}

OR

{
   "status":"success",
   "eventName":"my_test_event",
   "message":"Tracking Conversion successful for my_test_event.",
   "type":0,
   "attributes":{
      "name":"john",
      "number":"98987XXXXX",
      "plan_type":31,
      "user_score":"340"
   },
   "callbackType":"event"
}

In the above output, eventName will be the same as that you pass in the app. The other parameters will return the values corresponding to the scenario or problem that occurred when the event was triggered. So, below are the different values that you can receive in the callback:

STATUSMESSAGETYPECALLBACK TYPE
successTracking Conversion successful for <event_name>0event
failPlease check for Event Name, it shouldn't be NULL or EMPTY1event
failContext not found.2.0, 2.1, 2.2event
failInvalid SCOPE value found.3.0, 3.1, 3.2event
fail<event_name> event can be tracked once in days.4.0, 4.1event
failIt will get tracked after <remaining_days> days.event
fail<event_name> event can be tracked once in days.
It will get tracked from tomorrow or later.
5event
failAnalytics / Event Status is inactive in the NV Panel.6.0, 6.1, 6.2event
failWrong credentials found.
Recheck the NotifyVisitors BrandID and Encryption Key in your app's manifest file
7event
failSomething went wrong while processing via the API.8event
failNo response available corresponding to this event.9.0, 9.1event
failLIFE-CYCLE Events INACTIVE or Your account is not upgraded. Kindly activate LIFE-CYCLE Event within your NotifyVisitors account or upgrade your account if required.10event
failConversion failed.11.0, 11.1event
failAuthentication error.12.0, 12.1event
failSomething went wrong while processing the response13event
failNo internet found.16.0, 16.1event
failAttribution tracking is disabled in the NV Panel.17.0event

Notifyvisitors.event((String)eventName, (JSONObject)attributes, (String)ltv, (String)scope, callback);

For example,

let attributes = {
  "name":"john",
  "number":"98987XXXXX",
  "user_score":"340",
  "plan_type":31
};

Notifyvisitors.event("my_event",attributes, "7","2", (result) => {
    //do your task here
});

This callback will provide you with a response in the following format-

{
   "status":"success",
   "eventName":"app_launch",
   "message":"Tracking Conversion successful for app_launch.",
   "type":0,
   "callbackType":"event"
}

OR

{
   "status":"success",
   "eventName":"my_test_event",
   "message":"Tracking Conversion successful for my_test_event.",
   "type":0,
   "attributes":{
      "name":"john",
      "number":"98987XXXXX",
      "plan_type":31,
      "user_score":"340"
   },
   "callbackType":"event"
}

In the above output, eventName will be the same as that you pass in the app. The other parameters will return the values corresponding to the scenario or problem that occurred when the event was triggered. So, below are the different values that you can receive in the callback:

STATUSMESSAGETYPECALLBACK TYPE
successTracking Conversion successful for <event_name>0event
failPlease check for Event Name, it shouldn't be NULL or EMPTY.1event
failContext not found.2.0, 2.1, 2.2event
failInvalid SCOPE value found.3.0, 3.1, 3.2event
fail<event_name> event can be tracked once in days.4.0, 4.1event
failIt will get tracked after <remaining_days> days.event
fail<event_name> event can be tracked once in days.
It will get tracked from tomorrow or later.
5event
failAnalytics / Event Status is inactive in the NV Panel6.0, 6.1, 6.2event
failWrong credentials found.
Recheck the NotifyVisitors BrandID and Encryption Key in your app's manifest file.
7event
failSomething went wrong while processing via the API.8event
failNo response available corresponding to this event.9.0, 9.1event
failLIFE-CYCLE Events INACTIVE or Your account is not upgraded. Kindly activate LIFE-CYCLE Event within your NotifyVisitors account or upgrade your account if required.10event
failConversion failed.11.0, 11.1event
failAuthentication error.12.0, 12.1event
failSomething went wrong while processing the response.13event
failNo internet found.16.0, 16.1event
failAttribution tracking is disabled in the NV Panel.17.0event

EVENT NAME (String)

USAGE: To Name of events like sale, and register.

  • It is a string value.
  • Use only Alpha Numerics.
  • You can use white spaces or special characters.
  • You can use the underscore.

EVENT ATTRIBUTES (JSON Object)

USAGE: These attributes are associated with the Users' Event

Attribute values are passed in the form of Javascript:

  • Strings
  • Booleans
  • Numbers
  • Date Attribute values are written using Javascript date objects

Attribute Name should contain only:

  • Alpha-numerics
  • No spaces
  • Only underscore _
  • Name within " "
  • No special characters
  • Attribute ends with ;

LIFETIME VALUE (Integer)

USAGE: For awarding a score point to the user like- 10 or 100

SCOPE (Integer)

Usage: The scope of the event defines, whether the event should be tracked every time it occurs, or per session, or once in a lifetime. This parameter is used to minimize the duplication of data in analytics.
It is an integer whose values are as follows :

  1. Track every time the api is called.
  2. Track once per session.
  3. Track once in a lifetime.

How to Track Complex Event Attributes

  • You can pass complex event attributes with NotifyVisitors as List and Map data types.
  • You cannot create segments.
  • You can use this data for personalizing your campaigns in the following manner:
var attributes = {
  "name":"john",
  "number":"98987XXXXX",
  "user_score":"340",
  "plan_type":3,
  "Address": {
    "Flat" : "h-3/94",
    "Building Number" : "B2",
    "Locality" : "Bengali Road",
    "City"     : "Palam",
    "State"    : "Delhi",
    "PIN"      : "110045"
}};

Notifyvisitors.event("subscribed",attributes, "7","2");

Guidelines

  • NotifyVisitors from time to time, send events data in batches. This is done to maintain minimal network usage and preserve the battery life of our user mobiles. (How to Set Event Priority)Your Custom Event
  • Names and Custom Event Attribute names will be case-sensitive and must be under 50 characters in length.
  • Keep the String attribute values under 1000 characters in length.
  • Custom Event Attributes are of data types like:
    • String
    • Boolean
    • All subclasses of Number
    • Date
    • Map
    • List
  • Event Attributes for a Custom Event cannot exceed 25 times per data type.
  • You cannot create segments for an Event Attribute value that is a List or a Map. However, you can use it in personalized campaigns.
  • The first data point declared gets synced with NotifyVisitors. It will define the data type for the event attribute.
  • The data type must be consistent with the value that you store against the attribute. Do not change the data type at a later stage because it will no longer flow to your NotifyVisitors dashboard.