RelatedDigital SDK provides collecting data according to interaction of the user with your application.
You can find the methods that are designed for this purpose below.
Info |
---|
There is no need to enable any module to send data only. It is enough to initialize the SDK. |
Info |
---|
In order the data that you sent to be loaded to RMC panel correctly, you should use the same reference value (KEY_ID* veya E-Mail) that you use in your RMC account when sending data via mobile channel. *KEY_ID: It is the ID that you use to make a user unique in your system like CRM id, userId, customerId, accountId. exVisitorId value can be keyID or E-mail according to your structure. |
Signup
Kotlin
Code Block |
---|
|
RelatedDigital.signUp(
context = context,
exVisitorId = "exVisitorIdValue"
) |
Java
Code Block |
---|
|
RelatedDigital.signUp(
context,
"exVisitorIdValue"
); |
Info |
---|
You should send the value that you use to make a user unique on RMC panel with exVisitorId parameter. Example, email. |
You can send additional information via this method. The example below shows the usage of signUp()
method with OM.sys.TokenID and OM.sys.AppID parameters. These parameters are necessary to send push notifications and can be gotten from the RMC panel.
Kotlin
Code Block |
---|
|
val parameters = HashMap<String, String>()
parameters["OM.sys.TokenID"] = "tokenValue"
parameters["OM.sys.AppID"] = "appAliasValue"
RelatedDigital.signUp(
context = context,
exVisitorId = "exVisitorIdValue",
properties = parameters
) |
Java
Code Block |
---|
|
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("OM.sys.TokenID", "tokenValue");
parameters.put("OM.sys.AppID", "appAliasValue");
RelatedDigital.signUp(
context,
"exVisitorIdValue",
parameters
); |
Login
You can call login()
method with or without additional information like signUp()
method.
Kotlin
Code Block |
---|
|
RelatedDigital.login(
context = context,
exVisitorId = "exVisitorIdValue"
) |
Java
Code Block |
---|
|
RelatedDigital.login(
context,
"exVisitorIdValue"
); |
Info |
---|
You should send the value that you use to make a user unique on RMC panel with exVisitorId parameter. Example, email. |
Kotlin
Code Block |
---|
|
val parameters = HashMap<String, String>()
parameters["OM.sys.TokenID"] = "tokenValue"
parameters["OM.sys.AppID"] = "appAliasValue"
RelatedDigital.login(
context = context,
exVisitorId = "exVisitorIdValue",
properties = parameters
) |
Java
Code Block |
---|
|
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("OM.sys.TokenID", "tokenValue");
parameters.put("OM.sys.AppID", "appAliasValue");
RelatedDigital.login(
context,
"exVisitorIdValue",
parameters
); |
Also, you can send information that can be used to segment the users.
Kotlin
Code Block |
---|
|
val parameters = HashMap<String, String>()
parameters["OM.sys.TokenID"] = "tokenValue"
parameters["OM.sys.AppID"] = "appAliasValue"
parameters["OM.vseg1"] = "seg1Value"
parameters["OM.vseg2"] = "seg2Value"
parameters["OM.vseg3"] = "seg3Value"
parameters["OM.vseg4"] = "seg4Value"
parameters["OM.vseg5"] = "seg5Value"
parameters["OM.bd"] = "1995-09-02"
parameters["OM.gn"] = "m"
parameters["OM.loc"] = "istanbul"
RelatedDigital.login(
context = context,
exVisitorId = "exVisitorIdValue",
properties = parameters
) |
Java
Code Block |
---|
|
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("OM.sys.TokenID", "tokenValue");
parameters.put("OM.sys.AppID", "appAliasValue");
parameters.put("OM.vseg1", "seg1Value");
parameters.put("OM.vseg2", "seg2Value");
parameters.put("OM.vseg3", "seg3Value");
parameters.put("OM.vseg4", "seg4Value");
parameters.put("OM.vseg5", "seg5Value");
parameters.put("OM.bd", "1995-09-02");
parameters.put("OM.gn", "m");
parameters.put("OM.loc", "istanbul");
RelatedDigital.login(
context,
"exVisitorIdValue",
parameters
); |
Page View
You can use the customEvent()
method below to send the page name that the user is currently viewing.
You can put additional parameters to properties map or leave it empty.
Kotlin
Code Block |
---|
|
val parameters = HashMap<String, String>()
RelatedDigital.customEvent(
context = context,
pageName = "Frequently Asked Questions",
properties = parameters
) |
Java
Code Block |
---|
|
HashMap<String, String> parameters = new HashMap<String, String>();
RelatedDigital.customEvent(
context,
"Frequently Asked Questions",
parameters
); |
Product View
You can use customEvent()
method below when the user views a product in your application.
Kotlin
Code Block |
---|
|
val parameters = HashMap<String, String>()
parameters["OM.pv"] = "Product Code"
parameters["OM.pn"] = "Product Name"
parameters["OM.ppr"] = "Product Price"
parameters["OM.pv.1"] = "Product Brand"
parameters["OM.inv"] = "Number of items in stock"
RelatedDigital.customEvent(
context = context,
pageName = "Product View",
properties = parameters
) |
Java
Code Block |
---|
|
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");
RelatedDigital.customEvent(
context,
"Product View",
parameters
); |
Adding an Item to the Cart
You can call the customEvent()
method below when the user adds an item into the cart(basket).
Info |
---|
When the user removes the last item from the cart(basket), you should send OM.pb, OM.pu and OM.ppr parameters with empty String. Example, parameters["OM.pb"] = ""
parameters.put("OM.pb", "");
|
Kotlin
Code Block |
---|
|
val parameters = HashMap<String, String>()
parameters["OM.pbid"] = "Basket ID"
parameters["OM.pb"] = "Product1Code;Product2Code"
parameters["OM.pu"] = "Product1Quantity;Product2Quantity"
parameters["OM.ppr"] = "Product1Price*Product1Quantity;Product2Price*Product2Quantity"
RelatedDigital.customEvent(
context = context,
pageName = "Cart",
properties = parameters
) |
Java
Code Block |
---|
|
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("OM.pbid", "Basket ID");
parameters.put("OM.pb", "Product1Code;Product2Code");
parameters.put("OM.pu", "Product1Quantity;Product2Quantity");
parameters.put("OM.ppr", "Product1Price*Product1Quantity;Product2Price*Product2Quantity");
RelatedDigital.customEvent(
context,
"Cart",
parameters
); |
Purchase
You can use the customEvent()
method below when the user make a purchase in your application.
Kotlin
Code Block |
---|
|
val parameters = HashMap<String, String>()
parameters["OM.tid"] = "Transaction ID"
parameters["OM.pp"] = "Product1Code;Product2Code"
parameters["OM.pu"] = "Product1Quantity;Product2Quantity"
parameters["OM.ppr"] = "Product1Price*Product1Quantity;Product2Price*Product2Quantity"
RelatedDigital.customEvent(
context = context,
pageName = "Product Purchase",
properties = parameters
) |
Java
Code Block |
---|
|
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("OM.tid", "Transaction ID");
parameters.put("OM.pp", "Product1Code;Product2Code");
parameters.put("OM.pu", "Product1Quantity;Product2Quantity");
parameters.put("OM.ppr", "Product1Price*Product1Quantity;Product2Price*Product2Quantity");
RelatedDigital.customEvent(
context,
Product Purchase",
parameters
); |
Category View
You can use the customEvent()
method below when the user views a category page in your application.
Kotlin
Code Block |
---|
|
val parameters = HashMap<String, String>()
parameters["OM.clist"] = "Category Code/Category ID"
RelatedDigital.customEvent(
context = context,
pageName = "Category View",
properties = parameters
) |
Java
Code Block |
---|
|
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("OM.clist", "Category Code/Category ID");
RelatedDigital.customEvent(
context,
"Category View",
parameters
); |
Search
You can use the customEvent()
method below when the user makes a search in your application.
Kotlin
Code Block |
---|
|
val parameters = HashMap<String, String>()
parameters["OM.OSS"] = "Text Searched"
parameters["OM.OSSR"] = "Number of Results"
RelatedDigital.customEvent(
context = context,
pageName = "Search",
properties = parameters
) |
Java
Code Block |
---|
|
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("OM.OSS", "Text Searched");
parameters.put("OM.OSSR", "Number of Results");
RelatedDigital.customEvent(
context,
"Search",
parameters
); |
Banner Click
You can use the customEvent()
method when the user clicks on a banner in your application.
Kotlin
Code Block |
---|
|
val parameters = HashMap<String, String>()
parameters["OM.OSB"] = "Banner Name/Banner Code"
RelatedDigital.customEvent(
context = context,
pageName = "Banner Click",
properties = parameters
) |
Java
Code Block |
---|
|
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("OM.OSB", "Banner Name/Banner Code");
RelatedDigital.customEvent(
context,
"Banner Click",
parameters
); |
Favorilere Ekleme
You can use the customEvent()
method below when the user adds an item to his/her favorites.
Kotlin
Code Block |
---|
|
val parameters = HashMap<String, String>()
parameters["OM.pf"] = "Product Code"
parameters["OM.pfu"] = "1"
parameters["OM.pfr"] = "Product Price"
RelatedDigital.customEvent(
context = context,
pageName = "/om_evt.gif",
properties = parameters
) |
Java
Code Block |
---|
|
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("OM.pf", "Product Code");
parameters.put("OM.pfu", "1");
parameters.put("OM.pfr", "Product Price");
RelatedDigital.customEvent(
context,
"/om_evt.gif",
parameters
); |
Info |
---|
You should send "OM.pfu" as “1” when an item is added to the favorites; whereas you should send it as “-1” when an item is removed from the favorites. |
Info |
---|
You should send pageName parameter as "/om_evt.gif" when an item is added to or removed from the favorites. |
Favorilerden Çıkarma
You can use customEvent()
method below when the user removes an item from his/her favorites.
Kotlin
Code Block |
---|
|
val parameters = HashMap<String, String>()
parameters["OM.pf"] = "Product Code"
parameters["OM.pfu"] = "-1"
parameters["OM.pfr"] = "Product Price"
RelatedDigital.customEvent(
context = context,
pageName = "/om_evt.gif",
properties = parameters
) |
Java
Code Block |
---|
|
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("OM.pf", "Product Code");
parameters.put("OM.pfu", "-1");
parameters.put("OM.pfr", "Product Price");
RelatedDigital.customEvent(
context,
"/om_evt.gif",
parameters
); |
Info |
---|
You should send "OM.pfu" as “1” when an item is added to the favorites; whereas you should send it as “-1” when an item is removed from the favorites. |
Info |
---|
You should send pageName parameter as "/om_evt.gif" when an item is added to or removed from the favorites. |
App Tracker
App Tracker feature is for sending the list of the applications that were installed from Google Play Store, Amazon App Store and Huawei App Gallery and are still installed in the device of the user. You can call the
sendTheListOfAppsInstalled()
method below. It is up to you to determine how often you will call it and where in your code you will call it. (Example, in the launcher activity and once in a week).
Kotlin
Code Block |
---|
|
RelatedDigital.sendTheListOfAppsInstalled(
context = context
)
|
Java
Code Block |
---|
|
RelatedDigital.sendTheListOfAppsInstalled(
context
); |
Android provides 2 options to access the list of the applications installed in the device.
1-) You can write the package names of the applications that you are interested in into AndroidManifest.xml file as below:
Code Block |
---|
|
<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 applications installed in the device, you should add the permission below into AndroidManifest.xml file.
Code Block |
---|
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
|
Info |
---|
In the second option, Google Play Store may expect you to explain why you need this permission. https://developer.android.com/training/basics/intents/package-visibility First option does not require any permission. After applying one of the 2 options above it is enough to call RelatedDigital.sendTheListOfAppsInstalled()
|
Sending Location Permission Status
You can call sendLocationPermission
() method as below to send the location permission status for your application.
Kotlin
Code Block |
---|
|
RelatedDigital.sendLocationPermission(
context = context
) |
Java
Code Block |
---|
|
RelatedDigital.sendLocationPermission(
context
); |
Info |
---|
This information is sent with “OM.locpermit” and can have one of the 3 values below. "always" : The permission is granted even when the app is closed(background). "appopen" : The permission is granted only when the app is open. "none" : The permission is not granted at all. |
Registering Push Message Token
It is required to have token information of the user to send push messages. The token value that can be gotten from Firebase or Huawei should be sent with OM.sys.TokenID parameter. The value of OM.sys.AppID parameter can be taken from RMC panel. Go to this link and click on your push application.
The value of App Alias there is the value that you should send with OM.sys.AppID parameter. If you have any trouble, please get in contact with the support team.
You can send the parameters below in the events described on this page. You can find examples of this in SignUp and Login sections above.
Kotlin
Code Block |
---|
|
parameters["OM.sys.TokenID"] = "tokenValue"
parameters["OM.sys.AppID"] = "appAliasValue" // Will be gotten from RMC panel |
Java
Code Block |
---|
|
parameters.put("OM.sys.TokenID", "tokenValue");
parameters.put("OM.sys.AppID", "appAliasValue"); // Will be gotten from RMC panel |
...
Example Application
RelatedDigital Example Application