Integration for Cordova plugin

Follow the steps below Download the cordova ios plugin from download link and extract the zip file on your pc/mac and you’ll get the extracted plugin folder named as notifyvisitors_cordova.

Download Cardova Plugin

1. 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.

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 ../notifyvisitors_cordova   --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.


2.Showing In-App Notifications

Use following function to show in app popups. Pass the User Token & CustomRule as NSMutableDictionary or pass nil.

var arg = [UserTokenArray   , CustomRuleArray ];




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


3. User Identifiers

To identify the different app users, call the method userIdentifier as follows.

var arg = [“User_ID_String”,jsonDataAttributes  ];

4. 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.


5. Showing Instant Push Notification

To show instant push notification in your app, you can call the schedulePushNotificationwithNotificationID method like this:-

var arg = [“NotificationID”,”tag”,”time_in_second”,”Title”,”message”,”url_to_load”,”icon_image_url”  ];

6. Tracking events

To track the various app events, call the method event like:-

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

Where: eventName is the name of the event you want to track for example “sale”,

AttributesDictionary is the json (Key Value Pair) containing different properties of the event in the form of json object like:-

var AttributesDictionary = {“price”:”2000”, “Category”:”fancy” };

Ltv is the value you want to give to user corresponding to every particular event.

scope - 1 (called every time the function is called)

scope -2(called once for the session)

scope -3 (called once per lifetime)

7. 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.


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.

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:

var getParameters = notifyvisitors_cordova.getUrlParameter('p');
var jsonData =JSON.parse(res);
var paramValue = jsonData.Your_Param_Key;  ;

8. Handle Deeplink Navigation

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

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