Core Ingest Events
Core content block mainly focus on events related to app navigation of your application, such as events related to app -> app opening, app closing or moving to background. Also for the screen related events, how much time a user spends on a screen and also some basic functional events as well such as login, media related or search related events.
List of Events
Here's a list of events that can be tracked using the core module:
| Event Name | Type | Description |
|---|---|---|
| App | app | Track when the user opens/resumes/background/closes the app. (Auto Tracked) |
| Page | page | Track screen/activity changes along with session timing. (Auto Tracked) |
| Identify | identify | Track when user register/login/logout from the app. |
| Media | media | Track how your users interact with media to offer better |
| Search | search | Track how search responds to user queries. |
| Rate | rate | Track user ratings on different elements in the app. |
| Module Selection | module_selection | Track when a module is selected on the main screen. |
| Track Event | track | Allows partners to send custom events as specified for their special cases. |
| Action Response | action_response | Track how user reacted to the action. |
App Event
To Log application-related events regarding the user opening, resuming, closing the app, or putting the app in the background.
This is an auto-tracked event, you don't need to add anything to trigger this event.
Overview
| Param | Usability | Format | Enum Values | Description |
|---|---|---|---|---|
| action | REQUIRED | STRING | open, close, resume, background | Identify action for which the event is triggered. |
| start_time | REQUIRED | INTEGER | --- | Time the app took to open, render the first page. Calculated in milliseconds. Will be 0 for all app actions except app_open. |
| meta | OPTIONAL | ANY | --- | Any additional value that is sent with the log. |
Usage
- JSON
{
"name": "app",
"property": "open",
"ctx": {
"__ol": true,
"action": "open",
"start_time": "122"
}
}
Page Event
To Log screen viewing events that record when a screen is shown to the user. By default, SDK auto listens for page changes in the app.
This is an auto-tracked event, you don't need to add anything to trigger this event on Android Native and Web Applications. However, if you are using custom navigation graph in Android or React Native, then you need to use this event specifically with your route information.
Overview
| Param | Usability | Format | Enum Values | Description |
|---|---|---|---|---|
| path | REQUIRED | STRING | -- | The path of the screen in the application. |
| title | REQUIRED | STRING | -- | The title of the screen in the application. |
| render_time | REQUIRED | INTEGER | -- | The duration in milliseconds, the time it takes for the page to render the content on screen. |
| 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
CFCoreEvent.logIngest(
CoreEventType.Page,
logObject = PageObject(
path = activity.packageName,
title = activity.localClassName,
renderTime = renderTime,
)
)
Also disable the default page tracking in the CFLog.Builder() using .disableAutoPageTrack()
let pageObject = PageObject(
path: "path_value",
title: "title_value",
renderTime: 220)
CFCoreEvent.shared.logIngest(eventType: .Page, logObject: pageObject)
React native SDK provides support to auto track page duration and render time if you are using React Native Navigation.
You can use the provided function setupPageListener() after your Navigation.events().registerAppLaunchedListener in the App.js
This will include the listener block for tracking page render time and duration for you but if you are using other methodologies, you need to provide the values that yourself.
let pageProperties = {
path: "test Page Path",
title: "test page name",
render_time: 150,
};
CfCore.logIngestEvent(CoreIngestEventType.Page, pageProperties);
React native SDK provides support to auto track page duration and render time if you are using React Native Navigation.
You can use the provided function setupPageListener() after your Navigation.events().registerAppLaunchedListener in the App.js
This will include the listener block for tracking page render time and duration for you but if you are using other methodologies, you need to provide the values that yourself.
For Web, the Page Event is auto tracked based on the change in URL, you don't need to implement anything.
{
"name": "page",
"property": "MainActivity",
"ctx": {
"__ol": true,
"hello_rodlsss": "world",
"path": "io.kenkai.android.sdk.activities",
"render_time": "110.0",
"title": "MainActivity"
}
}
Identify Event
To Log identity events regarding the user of the app such as register, login, or log out you can use Identity log events that are divided into 3 different types.
Overview
| Param | Usability | Format | Enum Values | Description |
|---|---|---|---|---|
| action | REQUIRED | STRING | register, login, logout, blocked, unblocked | Identify action for which the event is triggered. |
| referral_code | OPTIONAL | STRING | --- | Referral code used by the app user on registration. |
| blocked_reason | OPTIONAL | STRING | --- | blocked reason if the user is blocked from accessing the app |
| blocked_remarks | OPTIONAL | STRING | --- | blocked remarks if the user is blocked from accessing the app |
Usage
- Android (Java/Kotlin)
- iOS (Swift)
- React Native (JS/TS)
- Web Application (JS/TS)
- JSON
CFCoreEvent.logIngest(
eventType = CoreEventType.Identify,
logObject = IdentifyObject(
userId = Common.testUserId,
action = IdentifyAction.Login,
referralCode = "ASDDSA"
)
)
let identifyObject = IdentifyObject(userId: username, action: IdentifyAction.Login)
CFCoreEvent.shared.logIngest(eventType: .Identify, logObject: identifyObject)
CFCore.logIngestEvent(CoreEventType.Identify, {
user_id: 'UserDoeTEST4',
action: IdentityAction.Login
} as IdentifyProperties);
CfLog.getSDKInstance().identify(
IdentityAction.Login,
"sdkTestUserId",
null
);
{
"name": "identify",
"property": "login",
"ctx": {
"__ol": true,
"action": "login",
"referral_code": "ASDDSA",
"userid": "UserDoeTEST4"
},
}
To log user Catalog Properties: User Catalog
Media Event
To Log media events regarding the use of multimedia elements in the app. This can be images, videos, or audio. The event logs elements regarding play, pause, view, seek or finish of the event.
Overview
| Param | Usability | Format | Enum Values | Description |
|---|---|---|---|---|
| media_id | REQUIRED | STRING | -- | Id for the media in question. |
| type | REQUIRED | STRING | video, audio, image | type for the media in question. |
| action | REQUIRED | STRING | view, play, pause, seek, finish, impression | action performed on the media in question. |
| seek_time | REQUIRED | INTEGER | -- | currentSeekTime of the media (Duration in Millisecond) when an action is performed. |
| 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
CFCoreEvent.logIngest(
eventType = CoreEventType.Media,
logObject = MediaObject(
mediaId = "mediaId",
mediaType = MediaType.Video,
mediaAction = MediaAction.Pause,
seekTime = 1234556
)
)
let mediaObject = MediaObject(mediaId: "374784738", mediaType: MediaType.Video, mediaAction: MediaAction.Pause, seekTime: 1234556)
CFCoreEvent.shared.logIngest(eventType: .Media, logObject: mediaObject)
let mediaProperties = {
type: MediaType.Image,
id: "testImageId",
action: MediaAction.View,
seek_time: 123,
};
Navigation.logIngestEvent(NavigationTypes.Media, mediaProperties);
const mediaData = {
media_id: 'Media Test ID',
type: MediaType.Video,
action: MediaAction.Finish,
seek_time: 300,
} as MediaProperties;
CFCore.logIngestEvent(CoreEventType.Media, mediaData);
{
"name": "media",
"property": "video",
"ctx": {
"__ol": true,
"action": "pause",
"media_id": "mediaId",
"seek_time": "1234556.0",
"type": "video"
},
}
Search Event
To Log search events regarding the use of search in the app. This refers to the use of search-related parameters in the app. From search results to the filters and the page number of the search API (if any).
Overview
| Param | Usability | Format | Enum Values | Description |
|---|---|---|---|---|
| query | REQUIRED | STRING | -- | Query on which the Search is performed. |
| module | REQUIRED | STRING | core, e_commerce, e_learning, screening, assessment, enrolment, medical_review, my_patients, appointments, prescription, lifestyle_mgmt, psychological_mgmt, counseling_mgmt, investigation, treatment_plan, transfers, other | Module on which the search is performed. |
| page | REQUIRED | INTEGER | -- | API page of the search results. default to 1 |
| filter | OPTIONAL | HASHMAP(STRING, Any) | -- | Key value pair for the filters if any applied on the search. |
| results_list | REQUIRED | ARRAY (STRING) | -- | Array of IDs for the search results. |
| 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 resultItems: List<String> = listOf("item ID 1", "item ID 2")
val filtersHashMap: HashMap<String, String> = HashMap()
filtersHashMap.put("filterName", "filterValue")
CFCoreEvent.logIngest(
eventType = CoreEventType.Search,
logObject = SearchObject(
query = "some Query",
searchModule = ModuleType.Core,
resultsList = resultItems,
filter = filtersHashMap,
page = 1
)
)
let resultItems: [String] = [ "item ID 1", "item ID 2"]
let filtersDictionaryData: [String: String] = ["filterName": "filterValue"]
let searchObject = SearchObject(query: "Hello Func model", searchModule: ModuleType.Screening, resultsList: resultItems, filter: filtersDictionaryData, page: 1)
CFCoreEvent.shared.logIngest(eventType: .Search, logObject: searchObject)
const searchData = {
query: 'find_Something',
module: ModuleType.Core,
results_list: ['test_result_1', "test_result_2"],
filter: {filterName: 'filterValue'},
page: 1,
} as SearchProperties;
CFCore.logIngestEvent(CoreEventType.Search, searchData);
const searchProperties = {
page: 1,
query: "Hello World",
results_list : results.map(item => item.id),
filter: filterOptions,
};
Navigation.logIngestEvent(NavigationTypes.Search, searchProperties, false);
{
"name": "search",
"property": "some Query",
"ctx": {
"__ol": true,
"filterName": "filterValue",
"module": "core",
"page": "1",
"query": "some Query",
"results_list": "item ID 1, item ID 2"
},
}
Rate Event
To Log Rate events on elements inside the application. Such elements can be an order, app rating itself or a service offered in the app.
Overview
| Param | Usability | Format | Enum Values | Description |
|---|---|---|---|---|
| rate_value | REQUIRED | FLOAT | --- | For providing the value for the rate. Should be in between 0 to 5 |
| type | REQUIRED | STRING | order, item, media, exam, question, module, process, form, section, app, hcw, hcw_site, facility, assessment, customer, other | For providing the type of the element being rated. |
| subject_id | REQUIRED | STRING | --- | To set the subject Id for the item being rated based on the type above. |
| 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
CFCoreEvent.logIngest(
eventType = CoreEventType.Rate,
logObject = RateObject(
rateValue = 4f,
type = RateType.Order,
subjectId = "testOrderId",
)
)
let rateObject = RateObject(
rateValue: 3,
type: RateType.Order.rawValue,
subjectId: "subjectId"
)
CFCoreEvent.shared.logIngest(eventType: .Rate, logObject: rateObject)
const rateData = {
rate_value: 3,
type: RateType.Exam,
subject_id: 'UserDoeTEST4',
} as RateProperties;
CFCore.logIngestEvent(CoreEventType.Rate, rateData);
let rateProperties = {
rate_value: 4.4,
type: RateType.Order,
subject_id: "testOrderId",
};
Navigation.logIngestEvent(NavigationTypes.Rate, rateProperties);
{
"name": "rate",
"property": "order",
"ctx": {
"__ol": true,
"rate_value": "4.0",
"subject_id": "testOrderId",
"type": "order"
},
}
Module Selection Event
To log module selection. You can select the module type with the log values.
Format
| Param | Usability | Format | Enum Values | Description |
|---|---|---|---|---|
| type | REQUIRED | STRING | screening, assessment, enrolment, medical_review, my_patients, prescription, counseling_mgmt, lifestyle_mgmt, psychological_mgmt, investigation, appointment, hcw_mgmt, treatment_plan, transfers, appointment, hcw_mgmt, break, caller_history, attend_call, single, dashboard, map, other | current module selected by the user in the patient mgmt section on the main screen. |
| 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
CFCoreEvent.logIngest(
eventType = CoreEventType.ModuleSelection,
logObject = ModuleSelectionObject(
type = ModuleType.Screening
)
)
let moduleSelectionEvent = ModuleSelectionObject(type: ModuleType.Screening)
CFCoreEvent.shared.logIngest(eventType: .ModuleSelection, logObject: moduleSelectionEvent)
CFCore.logIngestEvent(CoreEventType.ModuleSelection, {
type: ModuleType.Appointments,
});
let moduleObject = {
type: ModuleType.Break,
}
Navigation.logIngestEvent(NavigationTypes.ModuleSelection, moduleObject)
{
"name": "module_selection",
"property": "screening",
"ctx": {
"__ol": true,
"type": "screening"
},
}
Track Event
To log custom events based on specified use cases.
Format
| Param | Usability | Format | Enum Values | Description |
|---|---|---|---|---|
| name | REQUIRED | STRING | --- | name of the event, should not match with predefines SDK events. |
| property | OPTIONAL | STRING | --- | String based property for the event associated to the event. |
| meta | OPTIONAL | MAP (STRING, ANY) | --- | Key Value pair of properties for the events, where any is of primitive types. |
Usage
- Android (Java/Kotlin)
- iOS (Swift)
- React Native (JS/TS)
- Web Application (JS/TS)
- JSON
CFCoreEvent.logIngest(
eventType = CoreEventType.Track,
logObject = TrackEventObject(
name = "custom_event",
property = "testValue",
meta = mapOf(
"SomeKey" to "SomeValue",
"SomeKey2" to 22,
)
)
)
CFCoreEvent.shared.logIngest(
eventType: .Track,
logObject: TrackEventObject(
name: "custom_event",
property: "testValue",
meta: [
"SomeKey": "SomeValue",
"SomeKey2": 22,
]
)
)
CFCore.logIngestEvent(CoreEventType.Track, {
name: 'custom_event',
property: 'Custom Property',
meta: {
value: 42,
type: ModuleType.Appointments,
}
} as TrackEventProperties);
Navigation.logIngestEvent(NavigationTypes.Track, {
name: 'custom_event',
property: 'Custom Property',
meta: {
value: 42,
type: "test",
}
});
{
"name": "custom_event",
"property": "testValue",
"ctx": {
"__ol": true,
"somekey": "SomeValue",
"somekey2": 22,
},
}
Action CTA Event
Recommendations based actions provide payload in the response, which can be used to trigger the CTA event. The CTA event can be to open a certain page in the app or to perform a certain action such as adding an item to the cart directly.
This is a callback event, you need to process the response based on your app architecture and handle the action accordingly.
Overview
| Param | Format | Description |
|---|---|---|
| cta_type | STRING | Action to be performed as a part of the recommendation - redirect/add-to_cart |
| cta_id | STRING | id of the product being recommended. |
Usage
- Android (Java/Kotlin)
- iOS (Swift)
- React Native (JS/TS)
- Web Application (JS/TS)
class MyApplication : Application(), LifecycleEventObserver, ActionOnClickInterface {
override fun onCreate() {
super.onCreate()
ActionOnClickObject.actionOnClickInterface = this
}
override fun onActionOpened(actionAttributes : Map<String, String>) {
Log.d("Notification Opened", "Notification Opened: ${actionAttributes["cta_type"]} \n ${actionAttributes["cta_id"]} \n $actionAttributes")
Toast.makeText(this,
"Notification Opened\", \"Notification Opened: ${actionAttributes["cta_type"]} \\n ${actionAttributes["cta_id"]} \\n $actionAttributes", Toast.LENGTH_LONG).show()
}
}
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ActionOnClickObject.actionOnClickInterface = { actionAttrs in
// Define your logic here
let cta = actionAttrs?["cta_id"]
let itemID = actionAttrs?["cta_id"]
print(actionAttrs ?? "")
let actionItems = "\(cta ?? "null")||\(itemID ?? "null")"
print(actionItems) // Just for example, you can use this data as needed
}
}
}
// in App.tsx
const callback = (data: NudgeCallBack) => {
console.log('Received data from SDK:', data);
Alert.alert('Data from notif callback: ', JSON.stringify(data));
};
CFCore.getNudgeResponse(callback);
// in App.TSX
CfLog.getSDKInstance().on(CfLogEvents.ActionNudge, actionAttributes => {
console.log("ActionNudge received: ", actionAttributes);
const type = actionAttributes.cta_type;
if (type === CfLogEventType.Redirect) {
console.log("Redirect in this app");
} else if (type === CfLogEventType.AddToCart) {
console.log("Add-to-cart in this app");
} else {
console.log("received unknown event type: ", type);
}
});
Action Response Event
To Log responses on actions, we use the same ingest API and send the user's response there.
This is an auto-tracked event, you don't need to add anything to trigger this event.
Overview
| Param | Usability | Format | Enum Values | Description |
|---|---|---|---|---|
| ref | REQUIRED | STRING | -- | Intervention ref string provided in the request API |
| time | REQUIRED | STRING | -- | Time parameter provided by the request API. |
| response | REQUIRED | STRING | open, discard, block, shown, expired, error | Action of the user performed on the action. |
Usage
{
"name": "action_response",
"property": "open",
"props": {
"response": "open",
"internal": {...internal object from request}
}
}
Manage Auto Show InApp Actions
To show in-app messages on the screen of your choice, you can disable the auto show from the SDK initialisation as:
- Android (Java/Kotlin)
- iOS (Swift)
- React Native (JS/TS)
- Web Application (JS/TS)
CFLog.Builder()
.init(this) // pass in the context
...
.setAutoShowInAppMessage(autoShowInAppMessage = false) // use this and set the autoShowInAppMessage to false
...
.build()
then in your activity where you want to show the in-app message, you can show the nudge by using:
CFCoreEvent.showInAppMessage(ActionScreenType.Cart.toString()) // ActionScreenType is an enum provided in the SDK
CFLogBuilder()
...
.setAutoShowInAppMessages(showInAppMessage: false) // use this and set the showInAppMessage to false
...
.build()
then in your screens where you want to show the in-app message, you can show the action by using:
CFCoreEvent.shared.showInAppMessage(actionScreenType: .Cart) // actionScreenType is an enum provided in the SDK
To initialise Self Managed InApp messages, you need to follow the same steps in Android and iOS for setting up the flag. For calling the function individual screens/components you need to use the code bwlow:
CFCore.init({
...
isInAppMessagesAutoDisplay: false
});
then in your screens where you want to show the in-app message, you can show the action by using:
CFCore.showInAppMessage(ActionScreenType.Cart);
// in App.js
CfLog.createSDKInstance(
'<your-sdk-key>',
{
activateNudgeMechanism: true,
selfManagedNudges: true // use this and set the showInAppNudge to true
}
)
then in your screens/components where you want to show the in-app message, you can show the nudge by using:
CfLog.getSDKInstance().fetchInAppMessageActionForScreen(ActionScreenType.Cart); // NudgeScreenType is an enum provided in the SDK
Fetch Actions for UI Interventions
To show in-app messages on the screen of your choice, you can disable the auto show from the SDK initialisation as:
- Android (Java/Kotlin)
- iOS (Swift)
- React Native (JS/TS)
- Web Application (JS/TS)
CFCoreEvent.fetchActions(
invActionType = InvActionType.UIComponent,
actionRenderMethodType = ActionRenderMethodType.InAppComponent,
deliveryMode = ActionDeliveryMode.OneOff,
actionAttr = mapOf( "hello" to "world" ),
onResult = {
Toast.makeText(this, "CFCoreEvent.fetchActions", Toast.LENGTH_SHORT).show()
}
)
CFCoreEvent.shared.fetchActions(
invActionType: .UIComponent,
actionRenderMethodType: .InAppComponent,
deliveryMode: .OneOff,
actionAttr: nil,
onResult: { items in
print("✅ Received actions:", items)
}
)
CFCore.fetchActions(
InvActionType.UIComponent,
ActionRenderMethodType.inAppComponent,
ActionDeliveryMode.Cached,
{ screen: 'home' }
).then(
(response) => {
console.log('Fetched Actions:', response);
}
);
CfLog.getSDKInstance().fetchActions(
InvActionType.Message,
ActionRenderMethodType.InAppMessage,
ActionDeliveryMode.OneOff, {},
(actions) => {
console.log("✅ Actions received:", actions);
}
)