Events
Overview
Events in Nudge represent interactions between the end-users and your application. By tracking events, such as sign_up
or add_to_cart
, you gain insights into user behaviors and preferences. Nudge's API and SDK facilitate the tracking of these interactions across various platforms.
Tracking an event
- JavaScript
- Java
- Kotlin
- Dart
await nudge.track({ type: "EVENT_TYPE" });
Nudge.track("NAME_OF_EVENT", eventProperties, new Nudge.TrackCallback() {
@Override
public void onSuccess(String response) {
// Handle successful tracking
}
@Override
public void onError(Exception e) {
// Handle error in tracking
}
});
Nudge.track(eventType, eventProperties, object : Nudge.TrackCallback {
override fun onSuccess(response: String) {
// Handle successful tracking
}
override fun onError(e: Exception) {
// Handle error in tracking
}
})
await core.track(type:'EVENT_TYPE');
To track an event, you can use Nudge's API or SDK. Here are examples of how to track an event across different programming environments:
Event Properties
Each event can carry additional details about the interaction through event properties. These properties enrich the event data, allowing for a more nuanced targeting and analysis.
Examples include product_category
, price
, and other relevant information about the interaction.
You can send event properties along with your tracking call. Here's how to include event properties in different programming environments:
- Javascript
- Java
- Kotlin
- Dart
await nudge.track({type:'EVENT_TYPE',
properties: <String, dynamic>{
"product": "Fortune Cookies",
"quantity": 5,
"countryOfExport":"US",
}});
JSONObject userProperties = new JSONObject();
userProperties.put("name","Client User 1");
userProperties.put("age", 27);
userProperties.put("gender", "M");
userProperties.put( "country","US");
nudge.initSession(apiKey: <TOKEN>, externalId:'CLIENT_IDENTIFIABLE_USER_ID',properties: userProperties);
val userProperties = JSONObject().apply {
put("name", "Client User 1")
put("age", 27)
put("gender", "M")
put("country", "US")
}
nudge.initSession(apiKey = "<TOKEN>", externalId = "CLIENT_IDENTIFIABLE_USER_ID", properties = userProperties)
await core.track(type:'EVENT_TYPE',
properties: <String, dynamic>{
"product": "Fortune Cookies",
"quantity": 5,
"countryOfExport":"US",
});
Find your events in the dashboard
All the events that you send to Nudge will be visible in the events section on the side bar of your dashboard