Tracking Events

Import NotifyVisitors package

import Notifyvisitors from react-native-notifyvisitors';
declare var NotifyVisitors: any;

Tracking Events

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

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

Notifyvisitors.event("my_event",attributes, "7","2", 
(result) => {
    console.log(result);
});

Notifyvisitors.shared.event((String) event_name, (JSON Object)attributes, (String) ltv, (String) scope, 
 (String event_response) {
     // response
 });

//Example
var attributes = {"name" : "abc", "mobile" : "1234567890" };

Notifyvisitors.shared.event("event_a", attributes, "7", "1", (String  response) {
    //  response
 });

NotifyVisitors.event((String)eventName, (JSONObject)attributes, (String)ltv, (String)scope, 
  callback_function );

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

NotifyVisitors.event("event_a", attributes, "7","2", function(callback){
  alert("event response : " + callback); 
});
const eventData = {eventName:"Neeraj190", attributes:{"a":"b"}, lifeTimeValue:"1", scope:"7"};

NotifyVisitors.event(eventData).then(
  (value: any) => {
    console.log(value); // Success!
 });

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.

What’s Next