User Identification
Identify users to track their activity:// Identify user with ID only
Zixflow.instance().identify(userId = "user@example.com")
// Identify user with additional attributes
Zixflow.instance().identify(
userId = "user@example.com",
traits = mapOf(
"first_name" to "John",
"last_name" to "Doe",
"email" to "user@example.com",
"plan" to "premium"
)
)
// Identify user with ID only
Zixflow.instance().identify("user@example.com");
// Identify user with attributes
Map<String, Object> traits = new HashMap<>();
traits.put("first_name", "John");
traits.put("last_name", "Doe");
traits.put("email", "user@example.com");
Zixflow.instance().identify("user@example.com", traits);
Event Tracking
Track custom events:// Simple event
Zixflow.instance().track(name = "Button Clicked")
// Event with properties
Zixflow.instance().track(
name = "Product Purchased",
properties = mapOf(
"product_id" to "123",
"product_name" to "Widget",
"price" to 29.99,
"currency" to "USD"
)
)
// Event with timestamp
Zixflow.instance().track(
name = "Order Completed",
properties = mapOf("order_id" to "ABC123"),
timestamp = System.currentTimeMillis()
)
// Simple event
Zixflow.instance().track("Button Clicked");
// Event with properties
Map<String, Object> properties = new HashMap<>();
properties.put("product_id", "123");
properties.put("product_name", "Widget");
properties.put("price", 29.99);
Zixflow.instance().track("Product Purchased", properties);
Screen Tracking
Track screen views:// Manual screen tracking
Zixflow.instance().screen(
title = "Product Detail",
properties = mapOf(
"product_id" to "123",
"category" to "Electronics"
)
)
// Enable automatic activity screen tracking (in configuration)
val config = ZixflowConfigBuilder(this, "YOUR_API_KEY")
.autoTrackActivityScreens(true)
.build()
// Manual screen tracking
Map<String, Object> properties = new HashMap<>();
properties.put("product_id", "123");
properties.put("category", "Electronics");
Zixflow.instance().screen("Product Detail", properties);
Profile Attributes
Set user profile attributes:// Set profile attributes
Zixflow.instance().setProfileAttributes(
mapOf(
"age" to 30,
"gender" to "male",
"subscription_status" to "active"
)
)
Map<String, Object> attributes = new HashMap<>();
attributes.put("age", 30);
attributes.put("gender", "male");
Zixflow.instance().setProfileAttributes(attributes);
Device Attributes
Set device attributes:// Set device-specific attributes
Zixflow.instance().setDeviceAttributes(
mapOf(
"app_version" to "2.1.0",
"device_model" to BuildConfig.MODEL,
"os_version" to Build.VERSION.RELEASE
)
)
User Logout
Clear user identification when they log out:// Clear identified user
Zixflow.instance().clearIdentify()
Zixflow.instance().clearIdentify();
Get Device Token
Retrieve the registered push notification device token:val deviceToken = Zixflow.instance().registeredDeviceToken
if (deviceToken != null) {
println("Device token: $deviceToken")
} else {
println("Device token not yet registered")
}