Analytics utilities for Keen.io integration with UTM tracking and event collection.
- UTM parameter tracking (first-touch and current URL)
- LocalStorage persistence for first-touch attribution
- Pageview and custom event tracking
- Keen.io query execution
- Backend API proxy support (no third-party client scripts)
import {
trackPageview,
trackEvent,
executeKeenQuery,
collectUtm,
ensureFirstTouchUtm
} from '@orkid-labs/analytics-utils'
// Track pageview with UTM parameters
trackPageview('/dashboard', { userId: '123' })
// Track custom event
trackEvent('button_click', { buttonId: 'submit' })
// Collect UTM parameters
const utm = collectUtm()
// Execute Keen.io query
const result = await executeKeenQuery({
projectId: 'your-project',
readKey: 'your-read-key',
analysisType: 'count',
eventCollection: 'pageviews',
timeframe: 'last_7_days'
})MIT
analytics-utils — Keen.io analytics utilities — UTM tracking, event collection, and bot-aware telemetry helpers.
- Install:
npm install @orkid-labs/analytics-utils - Package: https://www.npmjs.com/package/@orkid-labs/analytics-utils
- API docs: https://docs.orkidlabs.xyz/packages/analytics-utils
- Docs: https://docs.orkidlabs.xyz/packages/analytics-utils
Related Orkid projects: react-utils, @orkid-labs/sdk
Orkid Labs builds gasless, MEV-protected swap routing and agent-native DeFi infrastructure — orkidlabs.xyz · @orkid-labs on npm · github.com/orkid-labs