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. |
Nudge Response | nudge_response |
Track how user reacted to the nudge. |
App Event
To Log application-related events regarding the user opening, resuming, closing the app, or putting the app in the background.
Auto-Tracked
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
Page Event
To Log screen viewing events that record how much time the user spends on each screen/activity/fragment. By default, SDK auto listens for page changes in the app along with session timings that implicates how to log a user spends on an activity, but you can also set the content block name for the page as well to specify the block the page is linked to, it can be core which represents basic app navigation, e-commerce if it is a page from your in-app marketplace, e-learning if it related to learning section inside the app.
Auto-Tracked for Android Native and Web Applications
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. |
duration | REQUIRED | FLOAT | -- | The duration in seconds, the user is spending on 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
CFCoreEvent.logIngest(
CoreEventType.Page,
logObject = PageObject(
path = activity.packageName,
title = activity.localClassName,
duration = sessionLength,
renderTime = renderTime,
)
)
Also disable the default page tracking in the CFLog.Builder()
using .disableAutoPageTrack()
For use-case where the auto tracking is enabled, you can also pass the page's content block information at the onCreate of activity/fragment as
let pageObject = PageObject(
path: "path_value",
title: "title_value",
duration: 19,
renderTime: 220)
CFCoreEvent.shared.logIngest(eventType: .Page, logObject: pageObject)
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.
If you are using React Navigation
then you can head to the post AutoTrack Page events with React Navigation in React Native Apps
here to look into the integration steps for it.
let pageProperties = {
path: "test Page Path",
title: "test page name",
duration: 3,
render_time: 150,
};
CfCore.logPageEvent(pageProperties);
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.
If you are using React Navigation
then you can head to the post AutoTrack Page events with React Navigation in React Native Apps
here to look into the integration steps for it.
For Web, the Page Event is auto tracked based on the change in URL, you don't need to implement anything.
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. |
blocked | OPTIONAL | OBJECT (BLOCKED OBJECT) | register, login, logout, (blocked, unblocked) | Identify action for which the event is triggered. |
Usage
CFCoreEvent.logIngest(
eventType = CoreEventType.Identify,
logObject = IdentifyObject(
userId = "appUserId",
action = IdentityAction.Login
)
)
OR
CFCoreEvent.logIngest(
eventType = CoreEventType.Identify,
logObject = IdentifyObject(
userId = "appUserId",
action = IdentityAction.Blocked,
blocked = BlockedObject(reason = "Reason for Blocking", remarks = "Some Remarks")
)
)
let identifyObject = IdentifyObject(
userId: "appUserId",
action: IdentityAction.Login.rawValue)
CFCoreEvent.shared.logIngest(eventType: .Identify, logObject: identifyObject)
OR
let identifyObject = IdentifyObject(
userId: "appUserId",
action: IdentityAction.Blocked.rawValue,
blocked: BlockedObject(reason: "someText", remarks: "some Remarks"))
CFCoreEvent.shared.logIngest(eventType: .Identify, logObject: identifyObject)
let identifyProperties = {
userId: "appUserId",
action: IdentityAction.Login,
};
CfCore.logIdentityEvent(identifyProperties);
OR
let identifyProperties = {
userId: "appUserId",
action: IdentityAction.Login,
blocked: {
reason: "some Reason",
remarks: "some Remarks"
}
};
CfCore.logIdentityEvent(identifyProperties);
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 |
---|---|---|---|---|
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. |
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
// For Image
CFCoreEvent.logIngest(
eventType = CoreEventType.Media,
logObject = MediaObject(
mediaId = "mediaId",
mediaType = MediaType.Image,
mediaAction = MediaAction.View,
time = 0,
)
)
// For Video and Audio
CFCoreEvent.logIngest(
eventType = CoreEventType.Media,
logObject = MediaObject(
mediaId = "mediaId",
mediaType = MediaType.Video,
mediaAction = MediaAction.Pause,
time = 1234556,
)
)
// For Image
let mediaObject = MediaObject(
id: "374784738",
type: MediaType.Image.rawValue,
action: MediaAction.View.rawValue,
time: 0
)
CFCoreEvent.shared.logIngest(eventType: .Media, logObject: mediaObject)
// For Video and Audio
let mediaObject = MediaObject(
id: "374784738",
type: MediaType.Video.rawValue,
action: MediaAction.Pause.rawValue,
time: 1234556
)
CFCoreEvent.shared.logIngest(eventType: .Media, logObject: mediaObject)
// For Image
let mediaProperties = {
media_id: "testRNMediaId",
media_type: MediaType.Image,
media_action: MediaAction.view
}
// For Video and Audio
let mediaProperties = {
media_id: "testRNMediaId",
media_type: MediaType.Video,
media_action: MediaAction.Play,
time: 3000, // currentSeekTime is the timeInMillis for the video/audio current timeframe
}
CfCore.logMediaEvent(mediaProperties)
// For Image
mediaProperties = {
contentBlock: ContentBlock.ECommerce,
type: ImageType.Image,
id: "testMediaId",
action: MediaAction.View,
}
// For Video and Audio
mediaProperties = {
contentBlock: ContentBlock.ECommerce,
type: ImageType.Video,
id: "testMediaId",
action: MediaAction.Play,
time: 3000 // currentSeekTime is the timeInMillis for the video/audio current timeframe.
}
Navigation.logIngestEvent(NavigationTypes.Media, mediaProperties)
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 (SEARCH ITEM OBJECT) | -- | Array of the search results. |
meta | OPTIONAL | ANY | --- | Any additional value that is sent with the log. |
Usage
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
Nudge CTA Event
Recommendations based nudges 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
This is a callback event, you need to process the response base don your app architecture.
Overview
Param | Format | Description |
---|---|---|
cta | STRING | Action to be performed as a part of the recommendation - redirect/add-to_cart |
id | STRING | id of the product being recommended. |
type | STRING | Type of the product being recommended - product type as drug/grocery |
Usage
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
NudgeOnClickObject.nudgeOnClickInterface = { cta, itemType, itemID in
let nudgeItems = "\(cta)||\(itemType)||\(itemID)"
print(nudgeItems) // Just for example, you can use this data as needed
}
}
}
// in App.js
CfLog.getSDKInstance().on(CfLogEvents.NudgeAction, (type, resource) => {
console.log(type + "-> " + resource.type + "-> " + resource.id)
if (type === CfLogEventType.Redirect) {
console.log('Redirect not implemented in this app')
} else if (type === CfLogEventType.AddToCart) {
console.log('Add-to-cart not implemented in this app')
} else {
console.log('received unknown event type: ', type)
}
})
Nudge Response Event
To Log responses on nudges, we use the same ingest API and send the user's response there.
Auto-Tracked
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 nudge. |
Usage
[FOR ANDROID NATIVE ONLY]
To show in-app messages on the screen of your choice, you can disable the auto show from the SDK initialisation as:
CFLog.Builder()
.init(this) // pass in the context
...
.setAutoShowInAppNudge(showInAppNudge = false) // use this and set the showInAppNudge to false
...
.build()
then in your activity where you want to show the in-app message, you can show the nudge by using: