Loyalty Ingest Events
Causal Foundry Android SDK Loyalty module consists of events for rewarding platforms. You need to implement this module if your app offers users some rewards, points on completing certain actions or achieving a certain milestone by using your app.
List of Events
Event Name | Type | Description |
---|---|---|
Level | level |
Track user's in-app loyalty level progress. |
Milestone | milestone |
Track user's progress regarding achieving in-app loyalty milestone. |
Promo | promo |
Track user's activity regarding promo section within app. |
Survey | survey |
Track user's interaction with survey inside the app. |
Reward | reward |
Track user's interaction with rewards inside the app. |
Level Event
To log the update of user level. It required the user level before update and user level after the update. You need to pass module id as well if the level update event is triggered because of the e-learning content block, any achievement in the e-learning platform.
Format
Param | Usability | Format | Enum Values | Description |
---|---|---|---|---|
module_id | REQUIRED | STRING | --- | Id for the module in question, especially if the module is e-learning. |
new_level | REQUIRED | INT | --- | Updated level score for the user's loyalty index. |
prev_level | REQUIRED | INT | --- | Previous level score for the user's loyalty index. |
meta | OPTIONAL | ANY | --- | Any additional value that is sent with the log. |
Usage
Milestone Event
To log actions regarding milestones which can be when the user achieved a milestone.
Format
Param | Usability | Format | Enum Values | Description |
---|---|---|---|---|
id | REQUIRED | STRING | --- | Id for the milestone user has achieved. |
action | REQUIRED | STRING | achieved | Action performed on the milestone. |
meta | OPTIONAL | ANY | --- | Any additional value that is sent with the log. |
Usage
Promo Event
To log the events associated of the promo lists and promo items and when they are clicked on.
Format
Param | Usability | Format | Enum Values | Description |
---|---|---|---|---|
id | REQUIRED | STRING | --- | Id for the promo user is viewing, applying. |
action | REQUIRED | STRING | view, apply | Action applied on promo by the user. |
items | REQUIRED | ARRAY (PROMO ITEM OBJECT) | --- | List of the items in the promo list. |
title | REQUIRED | STRING | --- | Title for the promo list user is interacting with. |
type | REQUIRED | STRING | add_to_cart, coupon | Type of promo user is interacting. |
meta | OPTIONAL | ANY | --- | Any additional value that is sent with the log. |
Usage
let promoItem1 = {
id: "itemId1",
type: PromoItemType.Drug,
}
let promoItem2 = {
id: "itemId2",
type: PromoItemType.Drug,
}
let promoProperties = {
id: "testPromoId",
action: PromoAction.Apply,
title: "50% off Purchase",
type: PromoType.AddToCart,
items: [promoItem1, promoItem2],
}
CfLoyalty.logPromoEvent(promoProperties)
let promoItem1 = {
id: "itemId1",
type: PromoItemType.Drug,
}
let promoItem2 = {
id: "itemId2",
type: PromoItemType.Drug,
}
let promoProperties = {
id: "testPromoId",
action: PromoAction.Apply,
title: "50% off Purchase",
type: PromoType.AddToCart,
items: [promoItem1, promoItem2],
}
Loyalty.logPromoEvent(promoProperties)
Survey Event
To log actions regarding interactions with surveys inside the app.
Format
Param | Usability | Format | Enum Values | Description |
---|---|---|---|---|
action | REQUIRED | STRING | view, impression, start, submit | Action on the survey. |
survey | REQUIRED | OBJECT SURVEY OBJECT | --- | Details about the survey. |
response | REQUIRED | ARRAY RESPONSE OBJECT | --- | Questions and user's responses to them. Only required for submit type. |
meta | OPTIONAL | ANY | --- | Any additional value that is sent with the log. |
Usage
CfLogSurveyEvent.Builder()
.setAction(SurveyAction.submit)
.setSurveyObject(SurveyObject(
id = "Some SurveyId",
is_completed = true,
reward_id = "testRewardId",
type = SurveyType.open_ended.name,
))
.setResponseList(arrayListOf(
SurveyResponseItem(
id = "345345",
question = "Some Question Text",
response = "Some Answer Text",
type = SurveyType.open_ended.name
),
SurveyResponseItem(
id = "123123",
question = "Some Question Text",
response = "Some Answer Text",
type = SurveyType.open_ended.name
)
))
.build()
let surveyObject = {
id: "surveyId1",
type: SurveyType.OpenEnded,
is_completed: true,
reward_id: "testRewardId"
}
let responseItem1 = {
id: "itemId2",
type: SurveyType.OpenEnded,
question: "hello world"
}
let surveyEventProperties = {
action: SurveyAction.Submit,
survey: surveyObject,
response: [responseItem1]
}
CfLoyalty.logSurveyEvent(surveyEventProperties)
let surveyObject = {
id: "surveyId1",
type: SurveyType.OpenEnded,
is_completed: true,
reward_id: "testRewardId"
}
let responseItem1 = {
id: "itemId2",
type: SurveyType.OpenEnded,
question: "hello world"
}
let surveyEventProperties = {
action: SurveyAction.Submit,
survey: surveyObject,
response: [responseItem1]
}
Loyalty.logSurveyEvent(surveyEventProperties)
{
"type": "survey",
"props": {
"action": "submit",
"survey": {
"id": "Some SurveyId",
"is_completed": true,
"reward_id": "testRewardId",
"type": "open_ended"
},
"response": [
{
"id": "345345",
"question": "Some Question Text",
"response": "Some Answer Text",
"type": "open_ended"
},
{
"id": "123123",
"question": "Some Question Text",
"response": "Some Answer Text",
"type": "open_ended"
}
]
}
}
Reward Event
To log actions regarding interactions with rewards inside the app.
Format
Param | Usability | Format | Enum Values | Description |
---|---|---|---|---|
id | REQUIRED | STRING | --- | Id of the reward. |
action | REQUIRED | STRING | view, add, redeem | Action on the reward. |
acc_points | OPTIONAL | FLOAT | --- | Points achieved for the reward. Only required for add type. |
total_points | REQUIRED | FLOAT | --- | Total points of user including the acc_points. |
redeem | OPTIONAL | OBJECT REDEEM OBJECT | --- | Details about redeem. Only required for redeem type. |
usd_rate | OPTIONAL | FLOAT | --- | Currency conversion for the cash type redeem. Only present when redeem is cash. (Auto Provided) |
meta | OPTIONAL | ANY | --- | Any additional value that is sent with the log. |
Auto-Tracked
usd_rate
is auto-tracked, you don't need to add anything for that.
Usage
let redeemObject = {
type: RedeemType.Cash,
points_withdrawn: 2,
converted_value: 5,
currency: CurrencyCode.EUR,
is_successful: true
}
let rewardEventProperties = {
id: "rewardId1",
action: RewardAction.View,
acc_points: 0,
total_points: 10,
redeem: redeemObject,
}
CfLoyalty.logRewardEvent(rewardEventProperties)
let redeemObject = {
type: RedeemType.Cash,
points_withdrawn: 2,
converted_value: 5,
currency: CurrencyCode.EUR,
is_successful: true
}
let rewardEventProperties = {
id: "rewardId1",
action: RewardAction.View,
acc_points: 0,
total_points: 10,
redeem: redeemObject,
}
Loyalty.logRewardEvent(rewardEventProperties)
{
"type": "reward",
"props": {
"id": "testRewardId",
"action": "redeem",
"acc_points": 10.0,
// random value for schema (not required for redeem type)
"total_points": 22.0,
"redeem": {
"converted_value": 2.3,
"currency": "USD",
"is_successful": true,
"points_withdrawn": 10.1,
"type": "cash"
},
"usd_rate": 1.0769131
}
}