Relay allowlisted events reported by the browser.
(
req: Request,
payload: { anonymousId?: string; events: FrontendTelemetryEvent[] },
)
| 169 | |
| 170 | /** Relay allowlisted events reported by the browser. */ |
| 171 | trackFromClient( |
| 172 | req: Request, |
| 173 | payload: { anonymousId?: string; events: FrontendTelemetryEvent[] }, |
| 174 | ): void { |
| 175 | const envelope = this.buildEnvelope(req, { |
| 176 | frontendProvided: true, |
| 177 | anonymousId: payload.anonymousId, |
| 178 | }); |
| 179 | |
| 180 | for (const ev of payload.events) { |
| 181 | if (ev.type === "page") { |
| 182 | this.emitPage(envelope, ev.name, ev.properties ?? {}); |
| 183 | } else { |
| 184 | this.emit(envelope, ev.name, ev.properties ?? {}); |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | /** Associate an actor with traits (e.g. on registration). */ |
| 190 | identifyActor(actor: TelemetryActor, traits: Record<string, unknown>): void { |
no test coverage detected