INSTALLATION

Index


Introduction


You should follow the steps below to activate WebInStats SDK on your WebSites/Apps. You can see steps for Android, iOs and Web on separated tabs.

Creating new user and new company on Admin Panel


If you don’t have WebInStats account You should create one. You can click here to create a new account. You can activate your account by clicking the activation link on the email. Now you can create a new company using New button on Create New Company page. You should type the information below.

 

  • Name : Please type your company name
  • Sub Domain : We create a subdomain to track your clicks.Subdomain must be similiar to your domain name. No special characters allowed. If your domain name is www.example.com you can type example here.
  • Web Site : You should type your WebSite URL here.
  • Time Zone : You should select your Time Zone. F.I. for Turkey you can select Europe/Istanbul, For London you can select Europe/London.
  • Character Set : You should select your WebSites’ character set. It’s 99% utf-8. But if you use different character set you should learn from your web master.

Downloading WebInStats SDK and add to the WebSite/Apps


If you create the company record successfully you must be sure that you company is selected on the left menu -> Select Application section. If you company is selected please select Admin Panel on the same section.

 

Downloading SDK and sample scripts


Firstly, You should download SDK (for Apps) or get the script code (for website) :

Web
Android
iOS
Web

Please go to Admin Panel -> Left Menu -> General Settings -> Generate Code. Copy the code in the page then follow the steps below.

Android

Android SDK runs on Android v4.1 (API 16) and above.

You can download Android SDK using the link below :

https://github.com/WebInStats/Android-SDK

For sample Android demo app  :

https://github.com/WebInStats/Android-Demo

iOS

iOS SDK runs on iOS v8.0 and above.

You can download iOs SDK using the link below :

https://github.com/WebInStats/iOS-SDK

For sample iOs demo app :

https://github.com/WebInStats/iOS-Demo

 

Appliyng WebInStats scripts to the WebSites/Apps


 

Web
Android
iOS / Swift
iOS / Objective-C
Web

Please copy this code to all of the pages on your website before the </body> tag. (Also you can add the code to the Tag Manager)


<script>
window.wiso = window.wiso || [];
window.wiso.push(
{s:"__YOUR_COMPANY_ID___"},
{_cburl:"//__YOUR_SUBDOMAIN__.webinstats.com/"},
{p:"__THE_PAGENAME_USER_CURRENTLY_VISIT__"},
{cuid:"__CUSTOMER_ID__"}, // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE 
{trid:"__UNIQUE_TRANSACTION_ID__"}, // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
{am:"__TRANSACTION_AMOUNT__"} // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
);
(function() {var _wis = document.createElement('script');_wis.type = 'text/javascript';_wis.async = true; 
_wis.src='//dbfukofby5ycr.cloudfront.net/a9/js/dlc1.49.js';var s = document.getElementsByTagName('script')[0]; 
s.parentNode.insertBefore(_wis, s); })();
</script>

Android

Add the line below to AndroidManifest.xml file :


<uses-permission android:name="android.permission.INTERNET"></uses-permission>

Add the code below to each activities activity tag :


<activity android:name=".MainActivity"
android:configChanges="orientation|screenSize">
</activity>

Complete the following steps in each activity of your application:


import webinstats.android_wis_141.Webinstats;
// define wiso object as a global object :
Webinstats wiso = new Webinstats("//__YOUR_SUBDOMAIN__.webinstats.com/","__YOUR_COMPANY_ID___","0");
// If you use activity, you must call execute method on onCreate() method in each activity
// If you use fragment activity, you must call execute method on onCreateView() method in each fragment
Map<String,String> map=new HashMap<>();
map.put("p","__THE_PAGENAME_USER_CURRENTLY_VISIT__");
map.put("cuid","__CUSTOMER_ID__"); // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE 
map.put("trid","__UNIQUE_TRANSACTION_ID__"); // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
map.put("am","__TRANSACTION_AMOUNT__"); // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
// For each activity => call execute function on onCreate() method 
wiso.execute(this,map);
// For each fragment activity => call execute function on onCreateView() method F.I. :  
wiso.execute(getActivity(),map);

Add the code below to each activities onDestroy method or each Fragment onDestroyView method:


// For each activity => call execute function on onDestroy() method 
wiso.onChangeState(this);
// For each fragment activity => call execute function on onDestroyView() method F.I. :  
wiso.onChangeState(getActivity());

// Add this line to app modules dependencies


dependencies {
implementation 'com.android.volley:volley:1.1.1'
}
iOS / Swift

Paste the code below for each viewcontroller on your app

// You should add Allow Arbitrary Loads = YES under App Transport Security Settings in info.plist file to use the SDK.
// To access methods from SDK in your Swift file add the following line to the begining of the class.
import iOS_wis
// Add the code below for each viewDidLoad() method on viewcontroller
let wiso = Webinstats("//__YOUR_SUBDOMAIN__.webinstats.com/","___YOUR_COMPANY_ID___","0")
var map = [String:String]()
map["p"] = "__THE_PAGENAME_USER_CURRENTLY_VISIT__"
map["cuid"] = "__CUSTOMER_ID__" // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE 
map["trid"] = "__UNIQUE_TRANSACTION_ID__" // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
map["am"] = "__TRANSACTION_AMOUNT__" // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
wiso.execute(view: self, localmap: map)

 

iOS / Objective-C
// You should add Allow Arbitrary Loads = YES under App Transport Security Settings in info.plist file to use the SDK.
// To access methods from SDK in your Objective-C file add the following line to the begining of the class.
@import iOS_wis
// Add the code below for each -(void)viewDidLoad method on viewcontroller
Webinstats* wiso = [[Webinstats alloc] init:@"//__YOUR_SUBDOMAIN__.webinstats.com/" :@"___YOUR_COMPANY_ID___" :@"0"];
NSMutableDictionary *map = [[NSMutableDictionary alloc] init];
[map setObject:@"__THE_PAGENAME_USER_CURRENTLY_VISIT__" forKey:@"p"];
[map setObject:@"__CUSTOMER_ID__" forKey:@"cuid"]; // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE
[map setObject:@"__UNIQUE_TRANSACTION_ID__" forKey:@"trid"]; // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
[map setObject:@"__TRANSACTION_AMOUNT__" forKey:@"am"]; // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
[wiso executeWithView:self localmap:map];

Installing Push Notification to the Apps


You can follow the steps below to integrate WebInStats-PushStats application to your apps.

Web
Android
iOS / Swift
iOS / Objective-C
Web

Download manifest.json and sw.js files from webinstats panel and add these files under your domain-root folder.


e.g :

manifest : https://webinstats.com/manifest.json,
service worker : https://webinstats.com/sw.js

Screen Shot 2018-12-31 at 12.52.37

Screen Shot 2018-12-31 at 12.52.48

Android

Add your FCM application’s configuration file below the app section :

Application File Hierarchy

Add the codes below to AndroidManifest.xml file between application tags :


<!-- Add your notification icon's source file to AndroidManifest.xml -->
<meta-data
android:name="push_notification_icon"
android:resource="@drawable/ntf"/>
<service
android:name="webinstats.android_wis_144.WebinstatsMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name="webinstats.android_wis_144.WebinstatsInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>

Complete the following steps in each activity of your application:


import webinstats.android_wis_141.Webinstats;
// define wiso object as a global object :
Webinstats wiso = new Webinstats("//__YOUR_SUBDOMAIN__.webinstats.com/","__YOUR_COMPANY_ID___","0");
// If you use activity, you must call execute method on onCreate() method in each activity
// If you use fragment activity, you must call execute method on onCreateView() method in each fragment
Map<String,String> map=new HashMap<>();
map.put("p","__THE_PAGENAME_USER_CURRENTLY_VISIT__");
map.put("cuid","__CUSTOMER_ID__"); // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE 
map.put("trid","__UNIQUE_TRANSACTION_ID__"); // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
map.put("am","__TRANSACTION_AMOUNT__"); // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
// for app push enable add line below to map
map.put("_enable_push","1");
// For each activity => call execute function on onCreate() method 
wiso.execute(this,map);
// For each fragment activity => call execute function on onCreateView() method F.I. :  
wiso.execute(getActivity(),map);

Add the code below to each activities onDestroy method or each Fragment onDestroyView method:


// For each activity => call execute function on onDestroy() method 
wiso.onChangeState(this);
// For each fragment activity => call execute function on onDestroyView() method F.I. :  
wiso.onChangeState(getActivity());
iOS / Swift

Choose your Appname.target file and enable Push Notifications in Capabilities tab


// To access methods from SDK in your AppDelegate.Swift file add the following line to the beginning of the class.
import iOS_wis

Add the codes below to the related methods. If you don’t use the methods you should add methods to AppDelegate.Swift file

At the end of your didFinishLaunchingWithOptions method, add the following line


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Webinstats("//__YOUR_SUBDOMAIN__.webinstats.com/","___YOUR_COMPANY_ID___","0").register(application, didFinishLaunchingWithOptions: launchOptions)
return true
}

Add the following methods, in your AppDelegate.Swift


func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {   
Webinstats("//__YOUR_SUBDOMAIN__.webinstats.com/","___YOUR_COMPANY_ID___","0").didReceiveNotification(application, didReceiveRemoteNotification: userInfo)
}
func application(_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let tokenParts = deviceToken.map { data -> String in
return String(format: "%02.2hhx", data)
}
let token = tokenParts.joined()
Webinstats.registerWithDeviceToken(deviceToken: token)
}

Paste the code below for each viewcontroller on your app

// You should add Allow Arbitrary Loads = YES under App Transport Security Settings in info.plist file to use the SDK.
// To access methods from SDK in your Swift file add the following line to the begining of the class.
import iOS_wis
// Add the code below for each viewDidLoad() method on viewcontroller
let wiso = Webinstats("//__YOUR_SUBDOMAIN__.webinstats.com/","___YOUR_COMPANY_ID___","0")
var map = [String:String]()
map["p"] = "__THE_PAGENAME_USER_CURRENTLY_VISIT__"
map["cuid"] = "__CUSTOMER_ID__" // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE 
map["trid"] = "__UNIQUE_TRANSACTION_ID__" // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
map["am"] = "__TRANSACTION_AMOUNT__" // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
// for app push enable add line below to map
map["_enable_push"] = "1"
wiso.execute(view: self, localmap: map)

 

iOS / Objective-C

Choose your Appname.target file and enable Push Notifications in Capabilities tab


// To access methods from SDK in your AppDelegate.m file add the following line to the beginning of the class.
@import iOS_wis

Add the codes below to the related methods. If you don’t use the methods you should add methods to AppDelegate.m file

At the end of your didFinishLaunchingWithOptions method, add the following line


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[[Webinstats alloc] init:@"//__YOUR_SUBDOMAIN__.webinstats.com/" :@"___YOUR_COMPANY_ID___" :@"0"] register:application didFinishLaunchingWithOptions:launchOptions];
return YES;
}

Add the following methods, in your AppDelegate.m


- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
[[[Webinstats alloc] init:@"//__YOUR_SUBDOMAIN__.webinstats.com/" :@"___YOUR_COMPANY_ID___" :@"0"] didReceiveNotification:application didReceiveRemoteNotification:userInfo];
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
NSString * deviceTokenString = [[[[deviceToken description]
stringByReplacingOccurrencesOfString: @"<" withString: @""] stringByReplacingOccurrencesOfString: @">" withString: @""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
NSLog(@"token : %@",deviceTokenString);
[Webinstats registerWithDeviceTokenWithDeviceToken:deviceTokenString];
}
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{
[[[Webinstats alloc] init:@"//__YOUR_SUBDOMAIN__.webinstats.com/" :@"___YOUR_COMPANY_ID___" :@"0"] saveTestParametersWithUrl:url];
return YES;
}

Paste the code below for each viewcontroller on your app

// You should add Allow Arbitrary Loads = YES under App Transport Security Settings in info.plist file to use the SDK.
// To access methods from SDK in your Objective-C file add the following line to the begining of the class.
@import iOS_wis
// Add the code below for each -(void)viewDidLoad method on viewcontroller
Webinstats* wiso = [[Webinstats alloc] init:@"//__YOUR_SUBDOMAIN__.webinstats.com/" :@"___YOUR_COMPANY_ID___" :@"0"];
NSMutableDictionary *map = [[NSMutableDictionary alloc] init];
[map setObject:@"__THE_PAGENAME_USER_CURRENTLY_VISIT__" forKey:@"p"];
[map setObject:@"__CUSTOMER_ID__" forKey:@"cuid"]; // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE
[map setObject:@"__UNIQUE_TRANSACTION_ID__" forKey:@"trid"]; // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
[map setObject:@"__TRANSACTION_AMOUNT__" forKey:@"am"]; // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
[map setObject:@"1" forKey:@"_enable_push"];
[wiso executeWithView:self localmap:map];

 

iOS 10 Rich Push Notifications


You should add NotificationExtension.target add your project.

Step 1 : File —> New —> Target -> Choose Notification Extension

1

2

In the general settings for the new target,add iOS_wis.framework.

Add the following code in your notification extension file

Swift
Objective-C
Swift

override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
if let bestAttemptContent = bestAttemptContent { 
contentHandler(Webinstats("//__YOUR_SUBDOMAIN__.webinstats.com/","___YOUR_COMPANY_ID___","0").didReceiveNotificationExtension(request, bestAttemptContent))
}
}
Objective-C

- (void)didReceiveNotificationRequest:(UNNotificationRequest *)request withContentHandler:(void (^)(UNNotificationContent * _Nonnull))contentHandler {
self.contentHandler = contentHandler;
self.bestAttemptContent = [request.content mutableCopy];
if(_bestAttemptContent){
contentHandler([[[Webinstats alloc] init:@"//__YOUR_SUBDOMAIN__.webinstats.com/" :@"___YOUR_COMPANY_ID___" :@"0"] didReceiveNotificationExtension:request :_bestAttemptContent]);
}
}

Add NotificationExtension to Appname.target -> General Settings-> Embedded Libraries.

3

Customizing default parameters


Default Parameters  :

 

Param Name Default Value Description Sample Usage
_isexec true if this parameter's value is true SDK automatically send request to the WebInStats server. You can set this parameter to false and you can call wiso._execute(); method whenever you want. You should add
{_isexec:false},
and you can call
wiso._execute();
method whenever you want
_ucisd false If Local Storage is disable on the browser (F.I. on private mode) you can set this parameter true to use cookie To able to store something when local storage disabled, you can add
{_ucisd:true},
line to the script.
_cd '' You can set cookie domain name to this field. if this parameter is empty system use *.domainname.com. To change cookie domain to my.webinstats.com you can add
{_cd:'my.webinstats.com'},
line to the script code.
_req_to 6000 Server request time out parameter. Default value is (6000=6 seconds) If server doesn't respond in 6 seconds system automatically close the connection. To change timeout to 4 seconds you can add :
{_req_to:4000},
line to the script code.
_fc false You can cache some css and js files on Local Storage to decrease the network request. You should use this parameter carefully because it increases stored data on local storage To activate it you can add
{_fc:true},
line to the script code.
_fct 1440 if _fc=true (file cache enabled) you can customize timeout for local file cache as minute (60=1 hour) To change the file cache timeout value you can add
{_fc:true},
{_fct:120}, // 2 hours
line to the script code.
_fcfs 40 if _fc=true (file cache enabled) you can set maximum cache limit. Default value is 40 KB To change the file cache size limit value you can add
{_fc:true},
{_fct:2880}, // 2 days
{_fcfs:20}, // Max 20 KB
line to the script code.
_cview true You can disable Viewability feature using this parameter. If this value set to true system automatically count views when banners are visible To disable it you can add
{_cview:false},
line to the script code.
ps '/' You can change Page separator parameter. This parameter allows you to set campaigns on sub pages. If your page structure is like "Product:Mobile Phones:Iphone" you can use : as page separator and you can set campaign on Product:Mobile Phones:@all pages. To change it to ":" you can add
{ps:":"},
line to the script code.
_cstto 1440 Default click cookie timeout parameter. To change it to 1 hour you can add
{_cstto:60},
line to the script code.
_csttoi 60 Default impression cookie timeout parameter. To change impression cookie timeout to 30 minutes you can add
{_csttoi:30},
line to the script code.
_uto 2628000 Default unique visitor cookie timeout as minute. Default value is 5 years. To change it to 1 year you can add :
{_uto:525600},
line to the script code.
_vto 30 Default visit timeout. to change visit timeout to 60 minutes you can add
{_vto:60},
line to the script code.
_runi null You can run any function on banner impression. To send all banner impressions to the google analytics as event you can add
{_runi:function(a){ga(ga.getAll()[0].get("name")+".send","event","WIS","impression",a.cn+"-"+a.n,!1)}},
line to the script code.
_runv null You can run any function on banner view. To send all banner views to the google analytics as event you can add
{_runv:function(a){ga(ga.getAll()[0].get("name")+".send","event","WIS","view",a.cn+"-"+a.n,!1)}},
line to the script code.
_runc null You can run any function on banner click. To send all banner clicks to the google analytics as event you can add
{_runc:function(a){ga(ga.getAll()[0].get("name")+".send","event","WIS","click",a.cn+"-"+a.n,!1)}},
line to the script code.
_runa null You can run any function on actions. To send all actions to the google analytics as event you can add
{_runa:function(a){ga(ga.getAll()[0].get("name")+".send","event","WIS","action",a.n,!1)}},
line to the script code.
_runar null You can run any function on action cancellation. To send all action cancellation to the google analytics as event you can add
{_runar:function(a){ga(ga.getAll()[0].get("name")+".send","event","WIS","actionremove",a.n,!1)}},
line to the script code.
_sck false if your website is https WebInStats create secure cookies to track all campaigns performance To create secure cookies You can add
{_sck:true},
line to the script code.

 

You can see the steps to customize default _vto (Visit Timeout) parameter to 60 minutes and _req_to (Request Timeout) parameter to 10000 ms (10 sn) :

 

Web
Android
iOS / Swift
iOS / Objective-C
Web

Please copy this code to all of the pages on your website before the </body> tag. (Also you can add the code to the Tag Manager)

<script>
window.wiso = window.wiso || [];
window.wiso.push(
{s:"__YOUR_COMPANY_ID___"},
{_cburl:"//__YOUR_SUBDOMAIN__.webinstats.com/"},
{p:"__THE_PAGENAME_USER_CURRENTLY_VISIT__"},
{cuid:"__CUSTOMER_ID__"}, // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE 
{trid:"__UNIQUE_TRANSACTION_ID__"}, // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
{am:"__TRANSACTION_AMOUNT__"}, // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
{_vto:"60"},
{_req_to:"10000"}
);
(function() {var _wis = document.createElement('script');_wis.type = 'text/javascript';_wis.async = true; 
_wis.src='//dbfukofby5ycr.cloudfront.net/a9/js/dlc1.49.js';var s = document.getElementsByTagName('script')[0]; 
s.parentNode.insertBefore(_wis, s); })();
</script>

Android

Add the line below to AndroidManifest.xml file :


<uses-permission android:name="android.permission.INTERNET"></uses-permission>

Add the code below to each activities activity tag :


<activity android:name=".MainActivity"
android:configChanges="orientation|screenSize">
</activity>

Complete the following steps in each activity of your application:

import webinstats.android_wis_141.Webinstats;
// define wiso object as a global object :
Webinstats wiso = new Webinstats("//__YOUR_SUBDOMAIN__.webinstats.com/","__YOUR_COMPANY_ID___","0");
// If you use activity, you must call execute method on onCreate() method in each activity
// If you use fragment activity, you must call execute method on onCreateView() method in each fragment
Map<String,String> map=new HashMap<>();
map.put("p","__THE_PAGENAME_USER_CURRENTLY_VISIT__");
map.put("cuid","__CUSTOMER_ID__"); // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE 
map.put("trid","__UNIQUE_TRANSACTION_ID__"); // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
map.put("am","__TRANSACTION_AMOUNT__"); // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
map.put("_vto","60");
map.put("_req_to","10000");
// For each activity => call execute function on onCreate() method 
wiso.execute(this,map);
// For each fragment activity => call execute function on onCreateView() method F.I. :  
wiso.execute(getActivity(),map);

Add the code below to each activities onDestroy method or each Fragment onDestroyView method:


// For each activity => call execute function on onDestroy() method 
wiso.onChangeState(this);
// For each fragment activity => call execute function on onDestroyView() method F.I. :  
wiso.onChangeState(getActivity());
iOS / Swift

Paste the code below for each viewcontroller on your app

// You should add Allow Arbitrary Loads = YES under App Transport Security Settings in info.plist file to use the SDK.
// To access methods from SDK in your Swift file add the following line to the begining of the class.
import iOS_wis
// Add the code below for each viewDidLoad() method on viewcontroller
let wiso = Webinstats("//__YOUR_SUBDOMAIN__.webinstats.com/","___YOUR_COMPANY_ID___","0")
var map = [String:String]()
map["p"] = "__THE_PAGENAME_USER_CURRENTLY_VISIT__"
map["cuid"] = "__CUSTOMER_ID__" // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE 
map["trid"] = "__UNIQUE_TRANSACTION_ID__" // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
map["am"] = "__TRANSACTION_AMOUNT__" // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
map["_vto"] = "60"
map["_req_to"] = "10000"
wiso.execute(view: self, localmap: map)
iOS / Objective-C

Paste the code below for each viewcontroller on your app

// You should add Allow Arbitrary Loads = YES under App Transport Security Settings in info.plist file to use the SDK.
// To access methods from SDK in your Objective-C file add the following line to the begining of the class.
@import iOS_wis
// Add the code below for each -(void)viewDidLoad method on viewcontroller
Webinstats* wiso = [[Webinstats alloc] init:@"//__YOUR_SUBDOMAIN__.webinstats.com/" :@"___YOUR_COMPANY_ID___" :@"0"];
NSMutableDictionary *map = [[NSMutableDictionary alloc] init];
[map setObject:@"__THE_PAGENAME_USER_CURRENTLY_VISIT__" forKey:@"p"];
[map setObject:@"__CUSTOMER_ID__" forKey:@"cuid"]; // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE
[map setObject:@"__UNIQUE_TRANSACTION_ID__" forKey:@"trid"]; // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
[map setObject:@"__TRANSACTION_AMOUNT__" forKey:@"am"]; // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
[map setObject:@"60" forKey:@"_vto"];
[map setObject:@"10000" forKey:@"_req_to"];
[wiso executeWithView:self localmap:map];

 

 

 

Sending extra parameters


You can send extra parameters to WebInStats system and you can use this parameters to create new campaigns. You must use correct parameter name if it’s possible you can use prefix for the extra parameters. F.I. if your company name is Example Company you can use exa prefix to easily remember the custom parameters. You must follow the rules below to create a new variable:

 

  • Parameter name can not start with wis_ .
  • Parameter name can not start with _.
  • Parameter name can not start with numeric value.
  • Parameter name can not contain special character except _.
  • Parameter name can not contain space character.
  • Parameter name can not have special Turkish, german..etc characters. (Such as üiçğş..).
  • Parameter name can be maximum 20 characters. Preferably minimum 5 characters.

 

WRONG PARAMETER NAME SAMPLES

wis_gender : (Parameter name can not start with wis_)

_gender : (Parameter name can not start with _.)

s : (It’s a special WebInStats parameter.  You can see system parameters by clicking this link.)

segment.3 : (Parameter name can not contain special character except _)

segment[3] : (Parameter name can not contain special character except _)

segment(3) : (Parameter name can not contain special character except _)

segment-3 : (Parameter name can not contain special character except _)

eski_segment_3_degeri :(Parameter name can be maximum 20 characters.)

3segment : (Parameter name can not start with numeric value)

doğumtarihi : (Parameter name can not have special Turkish, german..etc characters. (Such as üiçğş..))

dogum tarihi : (Parameter name can not contain space character).

CORRECT PARAMETER NAME SAMPLES : 

cinsiyet

segment3

segment_3

dogumtarihi

dogum_tarihi

segment3value

 

F.I. We want to send  user’s gender and total transaction count. Let’s assume that we want to use exagender and exatranscnt parameter names for these fields.

Web
Android
iOS / Swift
iOS / Objective-C
Web

Please copy this code to all of the pages on your website before the </body> tag. (Also you can add the code to the Tag Manager)

<script>
window.wiso = window.wiso || [];
window.wiso.push(
{s:"__YOUR_COMPANY_ID___"},
{_cburl:"//__YOUR_SUBDOMAIN__.webinstats.com/"},
{p:"__THE_PAGENAME_USER_CURRENTLY_VISIT__"},
{cuid:"__CUSTOMER_ID__"}, // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE 
{trid:"__UNIQUE_TRANSACTION_ID__"}, // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
{am:"__TRANSACTION_AMOUNT__"}, // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
{exagender:"Female"},
{exatranscnt:"765"}
);
(function() {var _wis = document.createElement('script');_wis.type = 'text/javascript';_wis.async = true; 
_wis.src='//dbfukofby5ycr.cloudfront.net/a9/js/dlc1.49.js';var s = document.getElementsByTagName('script')[0]; 
s.parentNode.insertBefore(_wis, s); })();
</script>

Android

Add the line below to AndroidManifest.xml file :


<uses-permission android:name="android.permission.INTERNET"></uses-permission>

Add the code below to each activities activity tag :


<activity android:name=".MainActivity"
android:configChanges="orientation|screenSize">
</activity>

Complete the following steps in each activity of your application:

import webinstats.android_wis_141.Webinstats;
// define wiso object as a global object :
Webinstats wiso = new Webinstats("//__YOUR_SUBDOMAIN__.webinstats.com/","__YOUR_COMPANY_ID___","0");
// If you use activity, you must call execute method on onCreate() method in each activity
// If you use fragment activity, you must call execute method on onCreateView() method in each fragment
Map<String,String> map=new HashMap<>();
map.put("p","__THE_PAGENAME_USER_CURRENTLY_VISIT__");
map.put("cuid","__CUSTOMER_ID__"); // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE 
map.put("trid","__UNIQUE_TRANSACTION_ID__"); // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
map.put("am","__TRANSACTION_AMOUNT__"); // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
map.put("exagender","Female");
map.put("exatranscnt","765");
// For each activity => call execute function on onCreate() method 
wiso.execute(this,map);
// For each fragment activity => call execute function on onCreateView() method F.I. :  
wiso.execute(getActivity(),map);

Add the code below to each activities onDestroy method or each Fragment onDestroyView method:


// For each activity => call execute function on onDestroy() method 
wiso.onChangeState(this);
// For each fragment activity => call execute function on onDestroyView() method F.I. :  
wiso.onChangeState(getActivity());
iOS / Swift

Paste the code below for each viewcontroller on your app

// You should add Allow Arbitrary Loads = YES under App Transport Security Settings in info.plist file to use the SDK.
// To access methods from SDK in your Swift file add the following line to the begining of the class.
import iOS_wis
// Add the code below for each viewDidLoad() method on viewcontroller
let wiso = Webinstats("//__YOUR_SUBDOMAIN__.webinstats.com/","___YOUR_COMPANY_ID___","0")
var map = [String:String]()
map["p"] = "__THE_PAGENAME_USER_CURRENTLY_VISIT__"
map["cuid"] = "__CUSTOMER_ID__" // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE 
map["trid"] = "__UNIQUE_TRANSACTION_ID__" // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
map["am"] = "__TRANSACTION_AMOUNT__" // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
map["exagender"] = "Female"
map["exatranscnt"] = "765"
wiso.execute(view: self, localmap: map)
iOS / Objective-C

Paste the code below for each viewcontroller on your app

// You should add Allow Arbitrary Loads = YES under App Transport Security Settings in info.plist file to use the SDK.
// To access methods from SDK in your Objective-C file add the following line to the begining of the class.
@import iOS_wis
// Add the code below for each -(void)viewDidLoad method on viewcontroller
Webinstats* wiso = [[Webinstats alloc] init:@"//__YOUR_SUBDOMAIN__.webinstats.com/" :@"___YOUR_COMPANY_ID___" :@"0"];
NSMutableDictionary *map = [[NSMutableDictionary alloc] init];
[map setObject:@"__THE_PAGENAME_USER_CURRENTLY_VISIT__" forKey:@"p"];
[map setObject:@"__CUSTOMER_ID__" forKey:@"cuid"]; // LEAVE THIS EMPTY IF USER IS NOT LOGGEDIN
// TWO PARAMETERS BELOW SHOULD BE ON THE PURCHASE PAGE
[map setObject:@"__UNIQUE_TRANSACTION_ID__" forKey:@"trid"]; // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
[map setObject:@"__TRANSACTION_AMOUNT__" forKey:@"am"]; // LEAVE THIS EMPTY IF IT'S NOT PURCHASE PAGE
[map setObject:@"Female" forKey:@"exagender"];
[map setObject:@"765" forKey:@"exatranscnt"];
[wiso executeWithView:self localmap:map];

Inline Banner Integration on Apps


 

Inline Banners are embedded banner areas on your apps. You can define inline banner containers in your apps and manage this containers’ content using WebInStats Admin Panel without sending a new release to AppStore or Google Play. You can show different content to different users and customize the content by segment, by user Type or by any parameter you defined in WebInStats SDK.

Android
IOS
Android

You should add a container with FrameLayout type to your app and you should define an id to this container.

To manage this containers’ content, you can define id to “selector” field on WebInStats Admin Panel’s Advanced tab.

Screen Shot 2018-09-10 at 10.10.08


<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/inlinebanner"
android:visibility="invisible">
</FrameLayout>
IOS

You should add a container on the page and you should set id to restorationidentifier field. You should use this id field on WebInStats Admin Panel to manage this containers’ content.

Important : You can define container as hidden and you can give 0 to the height value. Then you can create a new function to set banner’s height and you can trigger this function on WebInStats Admin Panel. If you define a content for the specific container WebInStats SDK change the container’s content then run the customized function (defined by your developers) to make it visible. You can read customizable functions section to see detailed information.

 

Screen Shot 2018-09-10 at 10.12.56

Screen Shot 2018-09-10 at 10.13.28

Screen Shot 2018-09-10 at 10.14.01

Customizable functions for your apps


You can create customized functions to trigger on banner’s impression or click.

F.I. If you want to apply a coupon code to the shopping cart when user click the banner, you can follow the steps below :

Android
IOS
Android

You can add a create_discount method to the ShoppingCart_Activity class. Coupon code will be automatically assigned to the “run_parameter” variable in JSONObject. You can use this coupon code and call your functions to apply the coupon code.

 

public void create_discount(JSONObject object){
String code = object.getString("run_parameter");
trigger_to_discount_func(code);
}

 

IOS

You can add a create_discount method to the ShoppingCart_ViewController class. Coupon code will be automatically assigned to the “run_parameter” variable in parameters. You can use this coupon code and call your functions to apply the coupon code.

 

func createDiscount(_ parameters : [String:Any]) {
var code : String = parameters[“run_parameter”]
trigger_to_discount_func(code : String)
}

 

Following the action of the user makes it easy to optimize your applications. In addition to the standard actions such as user registrations, purchases, you can add the following code block to the action area that you want to follow is triggered.

Android
IOS
Android

 

wiso.createEvent("Action_Name");

 

IOS

 

wiso.createEvent(eventname: "Action_Name")

 

Activating preview mode on Apps


You can download WebInStats Wistapp app on App Store or Google Play to see your campaigns on preview mode.

You should add code blocks below to your apps.

Android
IOS / Swift
IOS / Objective-C
Android

Please add the code below to onCreate() method on activity classes where you defined deep link definitions.

 

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.deep_link);
Intent appLinkIntent = getIntent();
Uri appLinkData = appLinkIntent.getData();
Webinstats wobj = new Webinstats("//__YOUR_SUBDOMAIN__.webinstats.com/","___YOUR_COMPANY_ID___","0");
wobj.saveTestParameters(this,appLinkData);
}

 

IOS / Swift

Please add the code below to application method on AppDelegate.swift file where you receive deep link request.

 

func application(_ application:UIApplication, open url:URL,sourceApplication:String?,annotation:Any)->Bool{
Webinstats("//__YOUR_SUBDOMAIN__.webinstats.com/","___YOUR_COMPANY_ID___","0").saveTestParameters(url: url)
return true
}

 

IOS / Objective-C

Please add the code below to application method on AppDelegate.m file where you receive deep link request.

 

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{
[[[Webinstats alloc] init:@"//__YOUR_SUBDOMAIN__.webinstats.com/" :@"___YOUR_COMPANY_ID___" :@"0"] saveTestParametersWithUrl:url];
return YES;
}