(params: {
event: AnalyticsEvent
distinctId?: string
properties?: AnalyticsProperties
})
| 141 | } |
| 142 | |
| 143 | export function shouldTrackAnalyticsEvent(params: { |
| 144 | event: AnalyticsEvent |
| 145 | distinctId?: string |
| 146 | properties?: AnalyticsProperties |
| 147 | }): boolean { |
| 148 | if (isFullTelemetryEnabled(params)) { |
| 149 | return true |
| 150 | } |
| 151 | |
| 152 | const rate = getEventSampleRate(params.event, params.properties) |
| 153 | if (rate >= 1) { |
| 154 | return true |
| 155 | } |
| 156 | if (rate <= 0) { |
| 157 | return false |
| 158 | } |
| 159 | |
| 160 | const bucket = |
| 161 | hashString(`${params.event}:${getSamplingKey(params)}`) / 0xffffffff |
| 162 | return bucket < rate |
| 163 | } |
| 164 | |
| 165 | function valueKind(value: unknown): string { |
| 166 | if (Array.isArray(value)) { |
no test coverage detected