@segment/analytics-next
Version:
Analytics Next (aka Analytics 2.0) is the latest version of Segment’s JavaScript SDK - enabling you to send your data to any tool without having to learn, test, or use a new API every time.
29 lines (26 loc) • 571 B
text/typescript
import { Context } from '../context'
export interface RecordIntegrationMetricProps {
integrationName: string
methodName: string
didError?: boolean
type: 'classic' | 'action'
}
export function recordIntegrationMetric(
ctx: Context,
{
methodName,
integrationName,
type,
didError = false,
}: RecordIntegrationMetricProps
): void {
ctx.stats.increment(
`analytics_js.integration.invoke${didError ? '.error' : ''}`,
1,
[
`method:${methodName}`,
`integration_name:${integrationName}`,
`type:${type}`,
]
)
}