Android User Tagging
You can tag users/devices from your SDK in one line of code.
The SDK looks after the details for the device, you just supply the tag key and
value:
- The tag name (key) is what you want to call it. In the example below
"ProductOffer" is how you will see this in the Contextual Dashboard.
- Contextual supports tags of: string, numeric and datetime. In the example below,
the key "ProductOffer" is assigned the value of "Liked" and is stored in the Contextual cloud.
Prerequisite:
- Contextual#init is successful (Tagging should only be used after onInstallRegistered callback)
| Contextual.tagString("ProductOffer", "Liked");
|
| String key = "BidValue";
double numeric_value = 549.99;
Pointzi.INSTANCE.tagNumeric(key, numeric_value); // double numeric_value
|
1
2
3
4
5
6
7
8
9
10
11
12
13 | // Example code using reserved keys
String key = "sh_registered";
String datetime_value = "2014-07-25 15:33:20";
Pointzi.INSTANCE.tagDatetime(key, datetime_value); // string Date time value in UTC
// Example code using custom tag
String key = "Birthday";
String datetime_value = "2014-07-25 15:33:20";
Pointzi.INSTANCE.tagDatetime(key, datetime_value);
// Example code using now as datetime in formated UTC
String key = "Birthday";
Pointzi.INSTANCE.tagDatetime(key);
|
Alternatively you may use getFormattedDateTime() API to get current time in UTC.
| String key = "ValueSaved";
Pointzi.INSTANCE.tagDatetime(key, Pointzi.getFormattedDateTime(System.currentTimeMillis()));
|
Other Tag Operations
Increment Tag Value
| String key = "PageVisited";
Pointzi.INSTANCE.incrementTag(key);
|
Remove Tag
| String key = "RemoveUser";
Pointzi.INSTANCE.removeTag(key);
|
Last update:
2024-01-14