Tracking Events

Track Events through NotifyVisitors using Events API.


Must Read

Before moving onto Tracking Events, it will be most helpful to get a better grasp of System & Custom events and their respective attributes. It will help you to understand the workings of Tracking Events much better.
Click here to view Custom Event Templates to get a good understanding.

NotifyVisitors immediately begins tracking once you integrate the SDK. These are referred to as
System Events, and they start tracking common user interactions with your app and also your
campaigns. Click here to view the System Events that we automatically track for you.
You can create your Custom Events that will track your user interactions, important to your business growth. You can further break down each Custom Event into more Event Attributes as:

  • Quantity
  • Price
  • Category

Granular data like this will enable you to engage more users through personalized and contextual
campaigns through Omni-channels or all channels of engagement.



What you see as “Platform” in the Custom Events of your NotifyVisitors dashboard is the sdk_id and signifies SDK type.
sdk_id 1 = Web
sdk_id 2 = Android
sdk_id 3 = iOS

Tracking Custom Events for Android

Events API records all the actions that the users perform. It also records any property associated with them.
These are used for:

  • Analytics
  • User segmentation
  • To trigger engagements or other actions

All API events are part of the NotifyVisitors Analytics object of iOS SDK. To get an instance of
NotifyVisitors Analytics object, find the code below:

notifyvisitors.trackEvents:(”eventName” Attributes:AttributesDictionary lifetimeValue:”Ltv” Scope:scope)
[notifyvisitors trackEvents:@”eventName” Attributes:AttributesDictionary lifetimeValue:@”Ltv” Scope:scope ];

EVENT_NAME (string)
USAGE: To Name of events like sale, register.

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

EVENT_ATTRIBUTES (NSMutableDictionary)
USAGE: These attributes are associated with Users' Event

Attribute values are passed in the form of NSMutableDictionary:

  • Strings
  • Booleans
  • Numbers
  • Date Attribute values are written using NSString using NSDateFormatter in the object

Attribute Name should contain only:

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

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.

Example for Tracking Events

notifyvisitors.trackEvents("subscribed", attributes: AttributesDictionary, lifetimeValue: "100", scope: 1)
[notifyvisitors trackEvents:@"subscribed" Attributes:AttributesDictionary lifetimeValue:@"100" Scope:1];

Tracking Event Attributes

You can specify a Custom Event Attribute by using NSDictionary. Attach the NSDictionary to the custom event that you would like to track, as specified below:

NSMutableDictionary *AttributesDictionary = [[NSMutableDictionary alloc] init]; 
           [AttributesDictionary setObject:@"John" forKey:@"name"]; 
           [AttributesDictionary setObject:@"[email protected]" forKey:@"email"];

           [notifyvisitors trackEvents:@"subscribed" Attributes:AttributesDictionary lifetimeValue:@"100" Scope:1];

How to Track Complex Event Attributes

  • You can pass complex event attributes with NotifyVisitors as NSArray and NSDictionary data types.
  • You cannot create segments using complex events attributes.
    You can use this data for personalizing your campaigns in the following manner:
NSDictionary *[email protected]{

NSDictionary *[email protected]{
  @"SKU Code":@"UHUH799",
  @"Product Name":@"Armani Jeans",

NSDictionary *[email protected]{

NSDictionary *[email protected]{
  @"SKU Code":@"FBHG746",
  @"Product Name":@"Hugo Boss Jacket",

NSDictionary *[email protected]{
  @"City":@"San Francisco",

NSDictionary *[email protected]{
  @"Products":@[product1, product2],
  @"Delivery Address":deliveryAddress,
  @"Coupons Applied":@[@"BOGO17"]

[notifyvisitors trackEvents:@"purchased" Attributes:[AttributesDictionary mutableCopy] lifetimeValue:@"100" Scope:1];


  • 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:

    • NSString
    • You can use Boolean as it's wrapped type is NSNumber
    • NS Number
    • NSDate
    • NSArray
  • 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 personalize 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.


Feel free to contact us at [email protected] if you need further help. We're only an email away!

What’s Next