Loyalty Ingest Events
Kenkai 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
- Android (Java/Kotlin)
- iOS (Swift)
- React Native (JS/TS)
- Web Application (JS/TS)
- JSON
val levelObject = LevelObject(
prevLevel = 4,
newLevel = 10,
moduleId = "testModuleId",
)
CFLoyaltyEvent.logIngest(
eventType = LoyaltyEventType.Level,
logObject = levelObject
)
let levelObject = LevelObject(
prevLevel: 1,
newLevel: 2,
moduleId: "eds"
)
CFLoyaltyEvent.shared.logIngest(eventType: .Level, logObject: levelObject)
let levelProperties = {
previous_level: 8,
new_level: 9,
module_id: "SomneModuleId",
}
CfLoyalty.logLevelEvent(levelProperties1)
let levelProperties = {
previous_level: 8,
new_level: 9,
module_id: "SomneModuleId",
}
Loyalty.logLevelEvent(levelProperties1)
{
"name": "level",
"property": "",
"ctx": {
"__ol": true,
"module_id": "testModuleId",
"new_level": "10.0",
"prev_level": "4.0"
},
}
Milestone Event
To log actions regarding milestones which can be when the user achieved a milestone.
Format
| Param | Usability | Format | Enum Values | Description |
|---|---|---|---|---|
| milestone_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
- Android (Java/Kotlin)
- iOS (Swift)
- React Native (JS/TS)
- Web Application (JS/TS)
- JSON
val milestoneObject = MilestoneObject(
id = "testMilestoneId",
action = MilestoneAction.Achieved,
)
CFLoyaltyEvent.logIngest(
eventType = LoyaltyEventType.Milestone,
logObject = milestoneObject
)
let milestoneObject = MilestoneObject(
id: "milestoneId",
action: .Achieved
)
CFLoyaltyEvent.shared.logIngest(eventType: .Milestone, logObject: milestoneObject)
let milestoneProperties = {
milestone_id: "testMilestoneId",
action: MilestoneAction.Achieved,
}
CfLoyalty.logMilestoneEvent(milestoneProperties)
let milestoneProperties = {
milestone_id: "testMilestoneId",
action: MilestoneAction.Achieved,
}
Loyalty.logMilestoneEvent(milestoneProperties)
{
"name": "milestone",
"property": "achieved",
"ctx": {
"__ol": true,
"action": "achieved",
"milestone_id": "testMilestoneId"
},
}
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 |
|---|---|---|---|---|
| promo_id | REQUIRED | STRING | --- | Id for the promo user is viewing, applying. |
| action | REQUIRED | STRING | view, apply | Action applied on promo by the user. |
| items_list | REQUIRED | ARRAY (STRING) | --- | List of IDs 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
- Android (Java/Kotlin)
- iOS (Swift)
- React Native (JS/TS)
- Web Application (JS/TS)
- JSON
val promoObject = PromoObject(
promoId = "testPromoId",
promoAction = PromoAction.Apply,
promoTitle = "Hello World",
promoType = PromoType.AddToCart,
promoItemsList = listOf("Hello", "World"),
)
CFLoyaltyEvent.logIngest(
eventType = LoyaltyEventType.Promo,
logObject = promoObject
)
let promoObject = PromoObject(
promoId: "testPromoId",
action: .Apply,
promoTitle: "Hello",
type: .Coupon,
promoItemsList: ["item1", "item2"]
)
CFLoyaltyEvent.shared.logIngest(eventType: .Promo, logObject: promoObject)
const promoProperties = {
promo_id: 'testId',
action: PromoAction.View,
title: 'testPromo',
type: PromoType.Coupon,
items_list: ['testId', 'testIdw'],
} as PromoProperties;
CFLoyalty.logIngestEvent(LoyaltyEventType.Promo, promoProperties, false);
let promoObject = {
promo_id: "promoId",
action: PromoAction.View,
items_list: ["item1", "item2"],
title: "Some Promo Title",
type: PromoType.AddToCart
}
CfLoyalty.logIngestEvent(LoyaltyTypes.Promo, promoObject)
{
"name": "promo",
"property": "apply",
"ctx": {
"__ol": true,
"action": "apply",
"items_list": "Hello, World",
"promo_id": "testPromoId",
"title": "Hello World",
"type": "add_to_cart"
},
}
Survey Event
To log actions regarding interactions with surveys inside the app.
Format
| Param | Usability | Format | Enum Values | Description |
|---|---|---|---|---|
| survey_id | REQUIRED | STRING | --- | ID of the survey |
| action | REQUIRED | STRING | view, impression, start, submit | Action on the survey |
| is_completed | REQUIRED | BOOLEAN | --- | Is Survey Completed? |
| reward_id | OPTIONAL | STRING | --- | ID of the Reward |
| type | OPTIONAL | STRING | open_ended, closed_ended, nominal, likert_scale, rating_scale, yes_no, interview, other | Type of the Reward |
| survey_questions | OPTIONAL | ARRAY (STRING) | --- | List of Questions in the Survey |
| response_list | OPTIONAL | ARRAY (STRING) | --- | List of Responses in the Survey |
| meta | OPTIONAL | ANY | --- | Any additional value that is sent with the log |
Usage
- Android (Java/Kotlin)
- iOS (Swift)
- React Native (JS/TS)
- Web Application (JS/TS)
- JSON
val surveyItem = SurveyEventObject(
action = SurveyAction.Submit,
id = "Some SurveyId",
isCompleted = true,
rewardId = "testRewardId",
type = SurveyType.OpenEnded,
surveyQuestions = listOf(
"Some Question Text 1",
"Some Question Text 2",
),
responseList = listOf(
"Some Answer Text 1",
"Some Answer Text 2",
)
)
CFLoyaltyEvent.logIngest(
eventType = LoyaltyEventType.Survey,
logObject = surveyItem
)
let surveyObject = SurveyEventObject(action: .Submit, surveyId: "2242423", surveyType : .OpenEnded, isCompleted: true, rewardId: "44342343", surveyQuestions: ["hello", "world"], responseList: ["1223","Good"])
let surveyObject = SurveyEventObject(
action: .Submit,
survey: survey,
responseList: [SurveyResponseItem]
)
CFLoyaltyEvent.shared.logIngest(eventType: .Survey, logObject: surveyObject)
let surveyObject = {
action: SurveyAction.View,
survey_id: "surveyObjectId",
is_completed: false,
reward_id: "rewardId",
type: SurveyType.OpenEnded,
survey_questions: ["Some Question here", "Some Question wwww"],
response_list: ["Some Answer here", "Somee"]
}
CfLoyalty.logSurveyEvent(surveyEventProperties)
let surveyObject = {
action: SurveyAction.View,
survey_id: "surveyObjectId",
is_completed: false,
reward_id: "rewardId",
type: SurveyType.OpenEnded,
survey_questions: ["Some Question here", "Some Question wwww"],
response_list: ["Some Answer here", "Somee"]
}
Loyalty.logSurveyEvent(surveyEventProperties)
{
"name": "survey",
"property": "submit",
"ctx": {
"__ol": true,
"action": "submit",
"is_completed": "true",
"response_list": "Some Answer Text 1, Some Answer Text 2",
"reward_id": "testRewardId",
"survey_id": "Some SurveyId",
"survey_questions": "Some Question Text 1, Some Question Text 2",
"type": "open_ended"
},
}
Reward Event
To log actions regarding interactions with rewards inside the app.
Format
| Param | Usability | Format | Enum Values | Description |
|---|---|---|---|---|
| reward_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_type | REQUIRED | STRING | cash, airtime, other | Type of redeem |
| redeem_points_withdrawn | REQUIRED | FLOAT | --- | Redeemed points of redeem |
| redeem_converted_value | REQUIRED | FLOAT | --- | Converted Value of redeem points |
| redeem_currency | REQUIRED | FLOAT | --- | Currency of the redeemed value |
| redeem_is_successful | REQUIRED | BOOLEAN | --- | If the redeem was successful |
| meta | OPTIONAL | ANY | --- | Any additional value that is sent with the log |
Usage
- Android (Java/Kotlin)
- iOS (Swift)
- React Native (JS/TS)
- Web Application (JS/TS)
- JSON
val rewardObject = RewardEventObject(
rewardId = "testRewardId",
action = RewardAction.Redeem,
totalPoints = 22f,
redeemType = RedeemType.Cash,
redeemPointsWithdrawn = 0.1f,
redeemConvertedValue = 2.3f,
redeemCurrency = CurrencyCode.USD,
redeemIsSuccessful = true
)
CFLoyaltyEvent.logIngest(
eventType = LoyaltyEventType.Reward,
logObject = rewardObject
)
let rewardObject = RewardEventObject(rewardId: "someReward", rewardAction: .Add, accPoints: 22, totalPoints: 22, redeemType: .Cash, redeemPointsWithdrawn: 11, redeemConvertedValue: 11, redeemIsSuccessful: true, redeemCurrency: .EUR)
CFLoyaltyEvent.shared.logIngest(eventType: .Reward, logObject: rewardObject)
const rewardEventProperties = {
reward_id: 'testID',
action: RewardAction.Add,
acc_points: 32,
total_points: 40,
redeem_type: RedeemType.Cash,
redeem_points_withdrawn: 300,
redeem_converted_value: 10,
redeem_currency: CurrencyCode.USD,
redeem_is_successful: true,
} as RewardProperties;
CFLoyalty.logIngestEvent(
LoyaltyEventType.Reward,
rewardEventProperties,
false,
);
let rewardObject = {
reward_id: "SomeRewardId",
action: RewardAction.Redeem,
acc_points: 22,
total_points: 223,
redeem_type: RedeemType.Cash,
redeem_points_withdrawn: 33,
redeem_converted_value: 22,
redeem_currency: CurrencyCode.IDR,
redeem_is_successful: false
}
CfLoyalty.logIngestEvent(LoyaltyTypes.Reward, rewardObject)
{
"name": "reward",
"property": "redeem",
"ctx": {
"__ol": true,
"acc_points": "0.0",
"action": "redeem",
"redeem_converted_value": "2.3",
"redeem_currency": "USD",
"redeem_is_successful": "true",
"redeem_points_withdrawn": "0.1",
"redeem_type": "cash",
"reward_id": "testRewardId",
"total_points": "22.0"
},
}