Copied To Clipboard



Import the NotifyVisitors SDK in your project

  1. Download the SDK from the link given below.
  2. Download SDK

  3. Extract the file and simply include the folder into your project

Add Plugin (Initialise plugin)

Now put plugin (i.e. notifyvisitors_cordova folder) and your your app in a same folder and add the plugin in your cordova app. To add plugin in your app open command line interface (CLI) i.e. cmd for windows and terminal for mac users and run the following commands.Follow the steps below.

  • iOS

        cd ~/path_to_your_cordova_app  
        cordova platform add ios
        Cordova plugin add <path/to/plugin>   --variable URL_SCHEME=yourapp   --variable BRAND_ID=YOUR_BRAND_ID   --variable SECRET_KEY=YOUR_SECRET_KEY
        cd ~/Desktop/my_cordova_app  
        cordova platform add ios
        cordova plugin add ../notifyvisitorsCordova_iOS   --variable URL_SCHEME=myapp   --variable BRAND_ID=52X --variable SECRET_KEY=768B370B0002A3DEE5E8CD991DA80A12 
        //  If you add plugin correctly you will see the following in your CLI.
        * Notifyvisitors iOS Cordova plugin successfully installed *

Open your ios Platform App in XCode and go to your project target > capability tab and turn on Push Notifications.


InApp Notifications

InApp Notifications include both Banners and Surveys. These are displayed based on iOS ViewControllers.

Every event occurs in the context of a ViewController. Every ViewController can be associated with some contextual data, which can be used as targeting rules for In-App Notifications.

Call the below show() Method in viewDidLoad method of every ViewController. show() Method should be called only once per ViewController.

  • iOS

        var arg = [UserTokenArray,CustomRuleArray ];

Default values are passed as nil.

Dynamic Tokens (NSMutableDictionary)Dynamic tokens are used to show personalised content in Notification messages real time.

Custom Rules (NSMutableDictionary)This data can be used in configuring targeting rules for the Notifications.

Sample Code

  • iOS

  • iOS

        var arg = [{"name":"Jhon"},{"Page":"index.html"}];

If you need to dismiss all inApp notifications currently viewing on screen, you can call DismissAllNotifyvisitorsInAppNotifications method like this:-

  • iOS


Push Notification

Showing Notification Center

You can show list of push notification received push notifications in an In-app Notification Center. To launch In-app notification center you can call the following method.

  • iOS


Track Users

User API enables you to track a users' activity as they move from device to device and attach attributes to their profiles. Attributes enrich user profiles, like email, username, mobile, gender etc.This method should be called when the user is identified (mostly on login).

  • iOS

        var arg = [“User_ID_String”,jsonDataAttributes  ];

USER_ID Setting the Unique ID is a critical piece to tie a user across devices and installs/uninstalls as well across all platforms (i.e. iOS, Android, Windows, The Web). Unique ID can be something like an email ID, a username (unique), or any Backend generated ID.

USER_ATTRIBUTES (jsonDataMutableDictionary) You can set the user attributes like name, email, mobile number. These can then be used to send personalised content in notifications. But these attributes can not be used in segmenting the users.

Default Attribute Names -

  • name
  • email
  • mobile

You can also pass your custom attributes like username, birthday, first name, last name.


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

Sample Code

  • iOS

        var userData = '{“name”:”Tom”, “email”:””, “mobile”:”98890XXXXX” }';
        var arg = [“yourUserID”,userData  ];

Track Events

Event API enables you to record any actions your users perform, along with any properties that describe the action. These are then used for analytics, user segmentation or to trigger engagements or other actions.

  • iOS

        var arg = [“eventName”,AttributesDictionary,”Ltv”,”scope”  ];

EVENT_NAME (string)Name of the event like sale, register. Event names should contain only alpha-numerics, white spaces or ‘_’ ; No other special characters are allowed.

EVENT_ATTRIBUTES (NSMutableDictionary)Attributes associated with the event. Attribute values should be passed in the form of Javascript strings, booleans and numbers respectively. Similarly date attribute values are expected in the form of Javascript date objects.


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

LIFETIME_VALUE (integer)The score you would like to reward the user on performing this event like 10, 100.

SCOPE (integer) The scope of the event, whether it should be tracked every time it is called, or per session, or once in a lifetime. This parameter is used to minimise the duplication of data in analytics. It is an integer whose values are :

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

Sample Code

  • iOS

        var AttributesDictionary = '{“price”:”2000”, “Category”:”fancy” }';
            var arg = [“YourEventName”,AttributesDictionary,”7”,”2” ];

Handle Call to Action Manually

Call the following method in OnDeviceReday Method to set the observer for navigation Views and pages of your App from NotifyVisitors in-App Messages Call to Action Buttons.

  • iOS


When you set call to action target Navigate In App then the observer triggers a javascript function app.nv_LoadView(); define a function nv_LoadView in your index.js to get the response and handle the button click actions.

  • iOS

        nv_LoadView:function(arg) {
        var ViewName = arg.ViewControllerToLoad;
        var parm = arg.Parameters;
        var pramJsonString = JSON.stringify(parm);
        var link = ViewName+'?p='+pramJsonString;
           window.location.href = link;

When the page loaded to get the array of parameters call the following function as follows:

  • iOS

       function handleOpenURL(schemeData) { 
        setTimeout(function() {    
        var link = schemeData.split('://');
        var url = link[1];  
        window.location = url;
        }, 0);  

To navigation a link inside app from deeplink url create a nv_HandleOpenUrl.js javascript file in js folder of your app and add in your index.html file before the cordova.js script tag and add the following code inside file:-

  • iOS

        var getParameters =  notifyvisitors.cordova.iOS.getUrlParameter('p');
        var jsonData =JSON.parse(getParameters);
        var paramValue = jsonData.Your_Param_Key;  ;