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 InviteReferrals_iOS. Download Cordova IOS SDK1. Add Cordova / PhoneGap iOS Plugin
Now put plugin (i.e. InviteReferrals_iOS 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.Select All
cd ~/path_to_your_cordova_app cordova platform add ios cordova plugin add--variable BRAND_ID=YOUR_BRAND_ID --variable ENCRYPTED_KEY=YOUR_ENCRYPTION_KEY --variable URL_SCHEME=yourappScheme
Example:
Select All
cd ~/Desktop/my_cordova_app cordova platform add ios cordova plugin add ../InviteReferrals_iOS --variable BRAND_ID=52X --variable ENCRYPTED_KEY=6F969A60F73C2218B6913465A5194CFC --variable URL_SCHEME=inmyapp // If you add plugin correctly you will see the following in your CLI. ******************************************************************** * InviteReferrals iOS Cordova plugin successfully installed * ********************************************************************
2. Add Referral Button
Use following function in your custom button click. Pass the CampaignID, Email, mobile and name inside an array at 0,1,2 and so on indexes respectively. Default campaignID will be applied if no campaignID specified.This will launch login screen of InviteReferrals.
Select All
var arg = ['Campaign_ID','Email_ID','Mobile','Name','subscriptionID' ];
InviteReferrals_iOS.launch(arg);
If you want to auto login on click of above custom button pass the email id as an string to launch share screen directly.
For Login Screen:
Select All
var arg = [‘12334’,’’,’’,’’,’’ ];
InviteReferrals_iOS.launch(arg);
For AutoLogin (Share Screen):
Select All
var arg = [‘12334’,’tom@gmail.com’,’9818XXXXXX’,’Tom’,’’];
InviteReferrals_iOS.launch(arg);
3. Show Refer a friend Popup
Just call the following function in .js file whenever you want to show the referral program popup.
Select All
var arg = ['rule_name','email','mobile',’name’,'subscriptionID' ];
InviteReferrals_iOS.showSharePopup(arg);
If you want to auto login from show refer friend popup pass the email id as an string to launch share screen directly.
For Login Screen:
Select All
var arg = [‘home’,’’,’’',’’,’’ ];
InviteReferrals_iOS.showSharePopup(arg);
For AutoLogin (Share Screen):
Select All
var arg = ['home','tom@gmail.com','9818XXXXXX',’’,’’ ];
InviteReferrals_iOS.showSharePopup(arg);
4. Pass User Details for Auto Login (Single Sign In)
Select All
var arg = ['email','mobile','name','gender','shareLink','shareTitle','shareDesc','shareImg','customValue','campaignID','flag','subscriptionID' ];
InviteReferrals_iOS.setupUserID(arg);
Example:
Select All
var arg = [‘tom@gmail.com’, '9818XXXXXX', 'Tom', 'Male', 'shareLink', 'shareTitle', 'shareDesc' ,'shareImg', 'customValue', '12334', 'launch',’’ ];
InviteReferrals_iOS.setupUserID(arg);
5. Tracking Install / Register / Sale Events
This is how you call tracking() method to track:
Select All
var arg = ['Event_Name','Order_ID','Purchase_Vaklue','Email','Mobile','Name',isDebugMode(true/false) ];
InviteReferrals_iOS.tracking(arg);
Example:
Install
Select All
var arg = [install,'','',’','','',true ];
InviteReferrals_iOS.tracking(arg);
Register
Select All
var arg = ['register','tom@gmail.com','999','devid@gmail.com','9818XXXXXX','Tom',false ];
InviteReferrals_iOS.tracking(arg);
Sale
Select All
var arg = ['sale','123AZXL43’,'999','tom@gmail.com','9818XXXXXX','Tom',false ];
InviteReferrals_iOS.tracking(arg);
Note: if App is on AppStore pass isDebugMode = NO in install tracking.
6. Show Welcome Message
Show welcome message to the customer if he comes through the referral of his friend
Select All
InviteReferrals_iOS.wecomeMessage();
FAQ:
Make sure that the font you imported to your app is being packed into app itself. Do that by selecting your Target, then Build Phases, then Copy Bundle Resources. If you don't see your font in there, simply add them by clicking on " + " sign on left bottom of Copy Bundle Resources tab.
Select All
var arg = [‘Navigation_Bar_Title’, ‘Bar_Button_Title’, ‘BarTextFontName’ ‘BarTitleFontSize’, ‘BarButtonFontSize’, ‘BarButtonIconWidth’,‘BarButtonIconHeight’‘Bar_Background_Color_(RGB_or_Hex)_/_Bar_Background_Image_URl’,’Bar_Tint_Color_in_RGB_/_Hex’]; InviteReferrals_iOS.NavigationBarAttributesWithTitle(arg);
Example:
Text Titles and Rgb/Hex Colors
Select All
var arg = [‘Title’,’Close’,’Futura,22,18,0,0,’rgba(227,188,99,0.8)’,’#ffffff’]; InviteReferrals_iOS.NavigationBarAttributesWithTitle(arg);
Image Urls and Rgb/Hex Colors
Select All
var arg = [‘Title’, ’https://s3.amazonaws.com/notifyvisitors/static/cross.png’, ’’ , 22, 0, 15, 15, ’https://d2gg9evh47fn9z.cloudfront.net/thumb_COLOURBOX8392247.jpg’, ’#19bdce’]; InviteReferrals_iOS.NavigationBarAttributesWithTitle(arg);