Personalized Interstitials
You can request an ad from our ad service. The wappier Optimization SDK provides you with the option to choose, if you want to draw the app completely by yourself or automatically by an AI custom view, developed by us.
Getting Tags
The tag is an arbitrary string value, which is passed in the method that displays an ad or requests the respective configuration. Frequently, the tags are the different app screens, in which the end-user visits and the client requests an ad for them(e.g., HOME_SCREEN
).
Below you will find how to get the available tags for your application and how these tags are used in order to display an ad in the app UI.
The wappier Optimization SDK exposes a method to get all available tags on the wappier Backend. By getting these tags you can proceed with a more dynamic/complex implementation of the personalized interstitials integration, in which in any new session the client asks for the available tags and use them to display an ad. However, this dynamic implementation is optional and it is feasible to have static tags in the client, which are used to show an ad.
You can get the available tags by calling the following method:
- Android (Java)
- iOS (obj-C)
- Unity (C++)
- C++
Wappier.getInstance().setAdsTagListener(new AdsListener() {
@Override
public void onTags(String type, List<String> tags) {
...
}
}, Collections.singletonList(AdType.CAMPAIGN));
The available adTypes are:
CAMPAIGN
for Dynamic Content Optimization Campaigns
PRICING
for Global Pricing Campaigns (available soon)
LOYALTY
for Loyalty&Retention Campaigns (available soon)
[WappierSDK addGetTagsListenerWithTypes:@[@"pricing", @"campaign"] callback:^(NSString *adType, NSArray<NSString *> *tags) {
...
}];
The available adTypes are:
CAMPAIGN
for Dynamic Content Optimization Campaigns
PRICING
for Global Pricing Campaigns (available soon)
LOYALTY
for Loyalty & Retention Campaigns (available soon)
string[] adTypes = { "CAMPAIGN" };
Wappier.Instance.setAdTags((type,tags) => { Debug.Log("Type : "+type); Debug.Log("Tags : " + tags[0]); }, adTypes);
The available adTypes are:
CAMPAIGN
for Dynamic Content Optimization Campaigns
PRICING
for Global Pricing Campaigns (available soon)
LOYALTY
for Loyalty & Retention Campaigns (available soon)
std::vector<WPAdTypes> adTypes{CAMPAIGN};
WappierSDKWrapper::getInstance()->setAdsTagListener(adTypes, [](const char* type,std::vector<const char*> tags){
....
});
The available adTypes are:
CAMPAIGN
for Dynamic Content Optimization Campaigns
PRICING
for Global Pricing Campaigns (available soon)
LOYALTY
for Loyalty & Retention Campaigns (available soon)
Creating Content Options
In order to request an ad, you need to create an instance, in which you should specify the options of the ad content. The options are the type of and the tag of the ad.
- Android(Java)
- iOS(obj-C)
- Unity(C#)
- C++
IAppOptions iAppOptions = new IAppOptions(boolean html, boolean image, String adType, String tag);
XNIAdOptions *options = [[XNIAdOptions alloc] initWithHTML:NO image:YES adType:@"INTERSTITIAL" tag:@"HOME_PAGE"];
Ad drawn by the SDK:
[WappierSDK showAdWithOptions:options delegate:YOUR_DELEGATE];
Ad drawn by yourself:
[WappierSDK getAdWithOptions:options delegate:YOUR_DELEGATE];
XNIAppOptions xNIAppOptions = new XNIAppOptions();
xNIAppOptions.tag = "HOME_PAGE";
xNIAppOptions.html = false;
xNIAppOptions.image = false;
xNIAppOptions.adType = "INTERSTITIAL";
auto* wpAdOptions = new WPAdOptions();
wpAdOptions->html = false;
wpAdOptions->image = false;
wpAdOptions->adType = "INTERSTITIAL";
wpAdOptions->tag = "HOME_PAGE";
Parameter | Description |
---|---|
html | HTML page (available soon) |
image | Image File (available soon) |
adType | Content Instance type (e.g.,INTERSTITIAL ) |
tag | Tag which can be found in the "setAdsTagListener" callback (e.g., HOME_PAGE |
Showing Dynamic Content
The wappier Optimization SDK can display dynamic content with the specified options by using the following method:
- Android(Java)
- iOS(obj-C)
- Unity(C#)
- C++
private IAdListener iAdListener = new IAdListener() {
@Override
public void onLoaded() {
...
}
@Override
public void onFailed(String error) {
...
}
@Override
public void onOpened() {
...
}
@Override
public void onClick(String action) {
...
}
@Override
public void onClosed() {
...
}
};
Wappier.getInstance().showAd(iAppOptions, iAdListener);
- (void)adContentDidLoad {
...
}
- (void)adContentDidLoadWithResponse:(NSDictionary *)response {
...
}
- (void)adContentDidOpen {
...
}
- (void)adContentDidClose {
...
}
- (void)adContentDidClickWithUrl(NSDictionary *url) {
...
}
- (void)adContentDidFailWithError:(NSError *)error {
...
}
public void showAd() {
Wappier.Instance.showAd(xNIAppOptions,
() => {
Debug.Log("Loaded");
},
(error) => {
Debug.Log("Error : " + error);
},
() => {
Debug.Log("Opened");
},
() => {
Debug.Log("Closed");
},
(action) => {
Debug.Log("Action : " + action);
});
}
WappierSDKWrapper::getInstance()->showAd(wpAdOptions, []() {
// Ad did Load
...
}, [](const char* error) {
// Ad load with error
...
}, []() {
// Ad did open
...
}, []() {
// Ad did close
...
}, [](const char* clickUrlResponse) {
// Ad tap action response
...
});
Alternatively, the Wappier Optimization SDK can provide the dynamic content configuration and the client will be responsible to display the respective instance with the following method:
WappierSDKWrapper::getInstance()->getAd(wpAdOptions, [](const char* response, const char* error) {
// Ad content response or error
...
}, []() {
// Ad content load
...
}););
You can cancel the dynamic content display by calling the following method:
- Android(Java)
- iOS(obj-C)
- Unity(C#)
- C++
Wappier.getInstance().cancelAdRequest();
[WappierSDK cancelAdRequest];
Wappier.Instance.cancelAdRequest();
WappierSDKWrapper::getInstance()->cancelAdRequest();
The wappier Optimization SDK can provide the dynamic content configuration and the client will be responsible to display the respective instance with the following method:
- Android(Java)
- iOS(obj-C)
- Unity(C#)
- C++
Wappier.getInstance().getAd(IAppOptions iAppOptions, IAdListener iAdListener, EventListener eventListener);
[WappierSDK getAdWithOptions:options delegate:YOUR_DELEGATE];
public void getAd() {
Wappier.Instance.getAd(xNIAppOptions,
() => {
Debug.Log("Loaded");
},
(error) => {
Debug.Log("Error : " + error);
},
() => {
Debug.Log("Opened");
},
(action) => {
Debug.Log("Action : " + action);
},
() => {
Debug.Log("Closed");
},
(response) => {
Debug.Log("Response getAd : " + response);
});
}
WappierSDKWrapper::getInstance()->getAd(wpAdOptions, [](const char* response, const char* error) {
// Ad content response or error
...
}, []() {
// Ad content load
...
}););
iAppOptions
&iAdListener
are described aboveeventListener
is a callback function to return the ad’s information
Opening Internal Deep Links
In case, the "scope" is "DEEP_LINK" and the "url" has a predefined value for specific deep links in the app, please redirect the end-user to the respective app page. A sample response can be found below:
- Android(Java)
- iOS(obj-C)
- Unity(C#)
- C++
{"type":"ON_CLICK","scope":"LINK","data":{"url":"app_xyz:\/\/open_profile"}}
{"type":"ON_CLICK","scope":"LINK","data":{"url":"app_xyz:\/\/open_profile"}}
{"type":"ON_CLICK","scope":"LINK","data":{"url":"app_xyz:\/\/open_profile"}}
{"type":"ON_CLICK","scope":"LINK","data":{"url":"app_xyz:\/\/open_profile"}}
Opening Loyalty User Profile
You can open the loyalty user profile through dynamic content by parsing the action message. When the user clicks on the OK button of the interstitial, the onClick()
callback has a value action which is of "String" data type. So, you have to convert this "String" message to "JsonObject" using a preferred 3rd party Library. A sample response can be found below:
- Android(Java)
- iOS(obj-C)
- Unity(C#)
- C++
{"type":"ON_CLICK","scope":"DEEP_LINK","data":{"url":"wappier:\/\/loyalty"}}
Please make sure, that the "scope" is "DEEP_LINK" and the "url" within the data object starts with "wappier" as domain and "loyalty" as the path of the url.
Below can be found a Java snippet that may help you:
public void onClick(String action) {
try {
JSONObject JsonAction= new JSONObject(action);
if(JsonAction.getString("scope").equals("DEEP_LINK")){
if(JsonAction.getJSONObject("data").getString("url").equals("wappier://loyalty")){
//Call the method that shows the loyalty user profile if scope is DEEP_LINK and url contains loyalty and starts with wappier
//The respective method in unity can be found below:
//Wappier.Instance.showLoyaltyView("DCO");
Wappier.getInstance().showLoyaltyView("DCO");
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
Opening External URLs
In case, the scope
is "LINK" and the url
has a value with domain "http" or "https" protocol, please open the respective URL using the device browser. A sample response can be found below:
- Android(Java)
- iOS(obj-C)
- Unity(C#)
- C++
{"type":"ON_CLICK","scope":"LINK","data":{"url":"http:\/\/www.google.com"}}
{"type":"ON_CLICK","scope":"LINK","data":{"url":"http:\/\/www.google.com"}}
Getting User Status
You can get the end user status for each wappier service. In the response, you can find if the end-user is included in the control or target group, for the wappier service that you are asking for.
To get User Status, add the following code:
- Android(Java)
- iOS(obj-C)
- Unity(C#)
- C++
// tags is a List<String> and can take values "all" | "loyalty" | "pricing" | "campaign"
List<String> tags = new ArrayList<>();
tags.add("loyalty");
tags.add("pricing");
tags.add("campaign");
Wappier.getInstance().getUserStatus(tags, new StringListener() {
@Override
public void onSuccess(String response) {
...
}
});
// tags is an Array<NSString> and can take values "all" | "loyalty" | "pricing" | "campaign"
NSArray *tags = @[
@"loyalty",
@"pricing",
@"campaging"
];
[WappierSDK getUserStatus:tags callback:^(NSDictionary * response) {
...
}];
// tags is a string[] and can take values "all" | "loyalty" | "pricing" | "campaign"
string[] tags = new string[] {"loyalty","pricing","campaign"}
Wappier.Instance.GetUserStatus(tags, UserStatusCallback);
void UserStatusCallback(string response)
{
//Handle response json
}
OR
Wappier.Instance.GetUserStatus(tags, response => {
//Handle response json
});
// tags is a std::vector<const char*> and can take values "all" | "loyalty" | "pricing" | "campaign"
std::vector<const char*> tags = {"loyalty","pricing","campaign"};
WappierSDKWrapper::getInstance()->getUserStatus(tags, [](const char* response) {
...
});
which takes a list of tags as an argument and returns a JSON response as a String.
Parameter | Description |
---|---|
loyalty | You will get the status of the user for the Loyalty and Retention service |
pricing | You will get the status of the user for the Pricing service |
campaign | You will get the status of the user for the Personalized Interstitials service |
all | You will get the status of the user for all wappier services |
Example Response:
"{
\"loyalty\" : {
\"population\" : 0.67220987,
\"control\" : false,
\"enabled\" : false
},
\"campaign\" : {
\"population\" : 0.36149076,
\"control\" : false,
\"enabled\" : false
},
\"pricing\" : {
\"population\" : 0.34617529,
\"control\" : false,
\"enabled\" : true,
\"globalPricing\": true,
\"personalizedPricing\": false,
\"billingCountry\": \"GR\",
\"isInScope\": true
}
}"
In the response, you may find if the user is included in the control or target group per each service.
If the end-user is included in the control group for the requested service if the {{service}}.control:true and {{service}}.enabled:false
If the end-user is included in the target group for the requested service if the {{service}}.control:false and {{service}}.enabled:true