Analytics integration
Learn how to integrate analytics for the Cordova Braze SDK.
Prerequisites
Before you start, you need to integrate the Cordova Braze SDK into your iOS or Android app.
Logging custom events
To log custom events, use the logCustomEvent()
method. For more in-depth instructions, see the Android and iOS guides for logging custom events.
1
2
3
var properties = {};
properties["KEY"] = "VALUE";
BrazePlugin.logCustomEvent("CUSTOM_EVENT_WITH_PROPERTIES", properties);
Logging purchases
To log purchases, use the logPurchase()
method. For more in-depth instructions, see the Android and iOS guides for logging purchases.
1
2
3
var properties = {};
properties["KEY"] = "VALUE";
BrazePlugin.logPurchase("PRODUCT_ID", 10, "USD", 5, properties);
If you want to log purchases at the order level instead of the product level, you can use order name or order category as the product_id
. Refer to our purchase object specification to learn more.
Setting custom attributes
To set custom attributes, use the setCustomUserAttribute()
method. For more in-depth instructions, see the Android and iOS guides setting custom attributes.
1
BrazePlugin.setCustomUserAttribute("KEY", "VALUE");
Setting user IDs
To set user IDs, use the changeUser()
method. For more in-depth instructions, see the Android and iOS guides for setting user IDs.
1
BrazePlugin.changeUser("USER_ID");