Customer.io Data Pipelines analytics client for browsers.
npm install @customerio/cdp-analytics-browser
import { AnalyticsBrowser } from '@customerio/cdp-analytics-browser'
const analytics = AnalyticsBrowser.load({ writeKey: '<YOUR_WRITE_KEY>' })
analytics.identify('hello world')
document.body?.addEventListener('click', () => {
analytics.track('document body clicked!')
})
If you're in our EU data center you will need to specify an alternate endpoint:
import { AnalyticsBrowser } from '@customerio/cdp-analytics-browser'
const analytics = AnalyticsBrowser.load({
cdnURL: 'https://cdp-eu.customer.io',
writeKey: '<YOUR_WRITE_KEY>'
})
analytics.identify('hello world')