Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In this page:

Table of Contents

...

Visilabs uses events to collect data from Android apps. The developer must follow the methods provided by the SDK. customEvent is a general method for tracking user activities. customEvent takes 2 parameters: pageName and parameters.

...

In SDK, apart from customEvent, there are 2 other methods to collect data: login and signUp. As in the customEvent method, the login and signUp methods also take a mandatory and an optional parameter. The first parameter is exVisitorId which uniquely identifies the user and can not be empty. The second parameter properties is optional and passsing an empty dictionary also valid.

In order for your data from the mobile channel to be uploaded to RMC, please pay attention that whatever reference value you have used in your active RMC account (KEY_ID * or E-Mail etc.) comes from the mobile channel with this reference.

*KEY_ID: These are the id values ​​used by the application owner to deduplicate the customer. These can be expressed with different names such as CRMid, userid, customerid, accountid.

ExVisitorId can be keyID or E-Mail depending on your structure.

Signup

Code Block
languagejava
Visilabs.CallAPI().signUp(exVisitorId: "userId/Email")

...

Code Block
languagejava
HashMap<String, String> parameters = new HashMap<>();
parameters.put("OM.sys.TokenID", token);
parameters.put("OM.sys.AppID", AppAlias); //From RMC Panel
Visilabs.callAPI().signUp(exVisitorId: "userId/Email", parameters)

Login

Like the Signup method, the login method can be called with or without optional parameter properties.

...

Code Block
languagejava
HashMap<String, String> parameters = new HashMap<>();
parameters.put("OM.vseg1", "seg1val") // Visitor Segment 1
parameters.put("OM.vseg2", "seg2val") // Visitor Segment 2
parameters.put("OM.vseg3", "seg3val") // Visitor Segment 3
parameters.put("OM.vseg4", "seg4val") // Visitor Segment 4
parameters.put("OM.vseg5", "seg5val") // Visitor Segment 5
parameters.put("OM.bd", "1995-09-02") // Doğum Günü
parameters.put("OM.gn", "m") // Cinsiyet
parameters.put("OM.loc", "Artvin") // Lokasyon
Visilabs.callAPI().login(exVisitorId: "userId", parameters)

Page View

To save the page name the visitor is currently viewing, use the customEvent method below. You can add extra parameters to the parameters or leave them blank.

Code Block
languagejava
HashMap<String, String> parameters = new HashMap<>();
Visilabs.callAPI().customEvent("Frequently Asked Questions", parameters)

Product View

Use the customEvent method below when the user views a product in the mobile app.

Code Block
languagejava
HashMap<String, String> parameters= new HashMap<String, String>();
parameters.put("OM.pv","Product Code");
parameters.put("OM.pn","Product Name");
parameters.put("OM.ppr","Product Price");
parameters.put("OM.pv.1","Product Brand");
parameters.put("OM.inv","Number of items in stock");

Visilabs.CallAPI().customEvent("Product View", parameters);

Add to Cart

When the user adds or removes a product to the cart, use the customEvent method below.

Code Block
languagejava
HashMap<String, String> parameters= new HashMap<String, String>();
parameters.put("OM.pbid","Basket ID");
parameters.put("OM.pb","Product1 Code;Product2 Code");
parameters.put("OM.pu","Product1 Quantity;Product2 Quantity");
parameters.put("OM.ppr","Product1 Price*Product1 Quantity;Product2 Price*Product2 Quantity");

Visilabs.CallAPI().customEvent("Cart", parameters);

Purchase

Use the customEvent method below when the user purchases one or more items.

Code Block
languagejava
HashMap<String, String> parameters= new HashMap<String, String>();
parameters.put("OM.tid","Transaction ID");
parameters.put("OM.pp","Product1 Code;Product2 Code");
parameters.put("OM.pu","Product1 Quantity;Product2 Quantity");
parameters.put("OM.ppr","Product1 Price*Product1 Quantity;Product2 Price*Product2 Quantity");

Visilabs.CallAPI().customEvent("Product Purchase", parameters);

Category View

When the user views a category list page, use the customEvent method below.

Code Block
languagejava
HashMap<String, String> parameters= new HashMap<String, String>();
parameters.put("OM.clist","Category Code/Category ID");

Visilabs.CallAPI().customEvent("Category View", parameters);

If the mobile app has a search function, use the customEvent method below.

Code Block
languagejava
HashMap<String, String> parameters= new HashMap<String, String>();
parameters.put("OM.OSS","Search Keyword");
parameters.put("OM.OSSR","Number of search results");

Visilabs.CallAPI().customEvent("In App Search", parameters);

Banner Click

You can track banner click data using the customEvent method below.

Code Block
languagejava
HashMap<String, String> parameters= new HashMap<String, String>();
parameters.put("OM.OSB","Banner Name/Banner Code");

Visilabs.CallAPI().customEvent("Banner Click", parameters);

Adding to Favorites

When a user adds a product to their favorites, use the customEvent method below.

Code Block
languagejava
HashMap<String, String> parameters= new HashMap<String, String>();
parameters.put("OM.pf","Product Code");
parameters.put("OM.pfu","1"); 
parameters.put("OM.pprpfr","Product Price");

Visilabs.CallAPI().customEvent("Add To Favorites", parameters);

Removing from Favorites

When the user removes a product from their favorites, use the customEvent method below.

Code Block
languagejava
HashMap<String, String> parameters= new HashMap<String, String>();
parameters.put("OM.pf","Product Code");
parameters.put("OM.pfu","-1"); 
parameters.put("OM.pprpfr","Product Price");

Visilabs.CallAPI().customEvent("Add To Favorites", parameters);

Send Campaign Parameters

After launching the application by clicking a push message, use the customEvent method below.

Code Block
languagejava
HashMap<String, String> properties = new HashMap<>();
properties.put("utm_campaign","euromsg campaign");
properties.put("utm_source","euromsg");
properties.put("utm_medium","push");
Visilabs.CallAPI().sendCampaignParameters(properties);

App Tracker

To use the App Tracker feature, simply call the following method from anywhere in your app and at any time interval (for example, once a week from within the launcher activity).

Code Block
languagejava
Visilabs.CallAPI().sendTheListOfAppsInstalled();

NOTE: In order to obtain a Visilabs Instance from Visilabs.CallAPI(), the Visilabs Instance must be created first with the Visilabs.CreateAPI() method. Pay attention to this when calling the above method.

Android offers 2 options to access the list of applications installed on the device:

1-) The applications that you want to get information about whether they are installed or not can be entered into the AndroidManifest.xml file with their package names as follows.

Code Block
languagexml
<manifest package="com.example.myApp">
    <queries>
        <package android:name="com.example.app1" />
        <package android:name="com.example.app2" />
    </queries>
    ...
</manifest>

2-) In order to get the list of all installed applications, the following permission must be entered in the AndroidManifest.xml file.

Code Block
languagexml
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" 
tools:ignore="QueryAllPackagesPermission" />

In method 2, it can be expected to explain why this permission is needed for the Google Play Store.

https://developer.android.com/training/basics/intents/package-visibility

Method 1 does not require any permissions. It is sufficient to call the Visilabs.CallAPI().sendTheListOfAppsInstalled() method after applying one of these above 2 methods.

Sending Location Status Information

You can send the location permission status of your users to the server as follows and use this information on the panel later.

Code Block
languagejava
Visilabs.CallAPI().sendLocationPermission();

This information is sent with the OM.locpermit parameter and can take one of the following 3 values:

"always" : Location permission is obtained while the application is open and closed.

"appopen" : Location permission is only obtained when the app is open.

"none" : Location permission is not obtained.

Saving a Push Message Token

VVisilabs needs a token to send users push messages. The token value generated by Firebase / Huawei will be the value of key OM.sys.TokenID. The value of OM.sys.AppID can be obtained by the RMC administration panel. Follow the link https://intelligence.relateddigital.com/a02/index#/Push/AppList and select the relevant push application. Application App Alias value corresponds to OM.sys.AppID. If you run into problems, please contact the RMC support team.

...