Tracking Events

Pass event attributes to track NV events.

📘

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.

📘

IMPORTANT!

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 the Web

You can track Custom Events through our Web SDK. You can also track associated event attributes
with it if you want to, as shown below:

nv('event', EVENT_NAME, EVENT_ATTRIBUTES, LIFETIME_VALUE, 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 (JSON object)
USAGE: These attributes are associated with an Event

Attribute values are passed in the form of Javascript:

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

📘

Important:

Attribute Names should contain only alpha-numerics, white spaces or ‘_’ ; No other special characters are allowed. Recommended names - ‘category’, ‘price_usd’

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 as 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 integrated.
  2. Track once per session.
  3. Track once in a lifetime.

Tracking Event Attributes

This is how you can track Custom Event Attributes for a Custom Event:

nv('event,"Added To Cart", {
    /* Numbers */
    "Product ID" : 137,
    "Price"      : 89.70,
    "Quantity"   : 1,

    /* Strings */
    "Product"    : "Givenchy Pour Homme Cologne",
    "Category"   : "Fragrance",
    "Currency"   : "USD",

    /* Boolean */
    "Discounted" : true
}
lifetimeValue:@"100" Scope:1);

nv('event',"Order Placed", {
    "Amount"             : 807.99,
    "Product 1 SKU Code" : "UHUH789",
    "Product 1 Name"     : "CK Jeans",
    "Product 1 Price"    : 300.09,
    "Product 1 Size"     : "L",
    "Product 2 SKU Code" : "FBHG756",
    "Product 2 Name"     : "Hugo Boss Jacket",
    "Product 2 Price"    : 507.90,
    "Product 2 Size"     : "L",
  
    /* Date */
    "Delivery Date"      : new Date("2017-01-09T00:00:00.000Z"),
        
    "Delivery City"      : "New York",
    "Delivery ZIP"       : "10001",
    "Coupon Applied"     : "BOGO17"
}
lifetimeValue:@"100" Scope:1);

How to Track Complex Event Attributes

● You can pass complex event attributes with NotifyVisitors as Array and Object data types.
● You cannot create segments.
● You can use this data for personalizing your campaigns in the following manner:

You can pass event Attributes that are complex in the following manner to your NotifyVisitors
account:

nv('event',"Order Placed", {
    "Amount"   : 807.99,

    /* Date */
    "Delivery Date" : new Date("2017-01-09T00:00:00.000Z"),

    /* Complex nested data */
    "Products" : [
        {
            "SKU Code": "UHUH789",
            "Product Name": "CK Jeans"
            "Price": 300.09,
            "Details": {
                "Size": "L"
            }
        },
        {
            "SKU Code": "FBHG756",
            "Product Name": "Hugo Boss Jacket"
            "Price": 507.90,
            "Details": {
                "Size": "L",
            }
        },
    ],

    /* Objects */
    "Delivery Address": {
        "City": "New York",
        "ZIP": "10001"
    },

    /* Arrays */
    "Coupons Applied": [
        "BOGO17"
    ]
}
lifetimeValue:@"100" Scope:1);

Add users and events at the same time

  1. More often than not, there exists a requirement to simultaneously track users and the events they perform. Since, if the users and the actions performed by them are tracked independently, then there are chances that the tracked events will not get tagged with their respective users primarily because there exists a ‘time gap’ between users getting tracked and then subsequently getting registered within the software’s database.
  1. To ensure that events always get mapped with their respective users, we created a new function through which both users and their corresponding actions get registered concurrently within the database. This new function namely UserEvent comes into effect exclusively when the tracked data of both the users and the events they performed is made available or catered to it.
  1. The syntax of the UserEvent function consolidates the functionality of the individual User and Event functions within a single function:
nv('userevent', [USER_ID, USER_ATTRIBUTES, EVENT_NAME, EVENT_ATTRIBUTES, LIFETIME_VALUE, SCOPE]);

Important points to note about the UserEvent function

  • All the data points are elements of an array in the UserEvent function.
  • In the case of the UserEvent function, the validation and processing of both the tracked user data and the corresponding event data, will work in the same manner as it does in the case of the existing User and Event functions.
  • Within the UserEvent function, if there exist certain issue(s) in the validation and processing of the tracked user data, then the events performed by the user won't trigger i.e, the tracked event data associated with the user will not get processed either, even if it is error-free and faultless (capable of being processed).
  • However, if the user data gets processed successfully i.e, the user gets registered within the software’s database, but there exist certain issue(s) in the processing of the tracked event data pertaining to the registered user, then the user will remain registered within the database and his/her faulty event data will get discarded or in other words, the erroneous events performed by him/her won't trigger.

📘

Note

For the function to operate, it is mandatory to provide it with two important pieces of datum viz. the USER_ID and the EVENT_NAME. The remaining data points within the array of the UserEvent function are optional. In short, it isn't mandatory to provide them since they aren't necessarily required for the function to work as intended. To learn more check out the articles titled ‘Tracking Users' and ‘Tracking Events'.

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

Guidelines

  • Your Custom Event Names will be case-sensitive and must be under 50 characters in length.
  • Custom Event Attribute names are also case-sensitive and must be under 50 characters in
    length.
  • String attribute values must be under 1000 characters in length.
  • Custom Event Attributes are of data types like:
    1. String
    2. Boolean
    3. Number
    4. Date
    5. Object
    6. Array
  • Event Attributes for a Custom Event cannot exceed 25 times per data type.
  • The initial 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 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.
  • The integration code loads and initializes NotifyVistiors SDK asynchronously, so that it does not affect the page load time of your website.

What’s Next