Browser Quick Start
import { AnalyticsBrowser } from '@zixflow/analytics-browser'
// Initialize with your API key
const analytics = AnalyticsBrowser.load({
apiKey: 'YOUR_API_KEY'
})
// Identify a user
analytics.identify('user@example.com', {
first_name: 'John',
last_name: 'Doe',
email: 'user@example.com'
})
// Track an event
analytics.track('button_clicked', {
button_name: 'signup',
page: 'homepage'
})
// Track a page view
analytics.page('Home', {
title: 'Homepage',
url: window.location.href
})
Node.js Quick Start
import { Analytics } from '@zixflow/analytics-node'
// Initialize with your API key
const analytics = new Analytics({
writeKey: 'YOUR_API_KEY'
})
// Identify a user
analytics.identify({
userId: 'user@example.com',
traits: {
first_name: 'John',
last_name: 'Doe',
email: 'user@example.com'
}
})
// Track an event
analytics.track({
userId: 'user@example.com',
event: 'purchase_completed',
properties: {
product_id: '123',
price: 29.99,
currency: 'USD'
}
})
// Flush events before exit
await analytics.closeAndFlush()