(
pathOrProperties?: string | TrackProperties,
propertiesOrUndefined?: TrackProperties
)
| 300 | screenView(properties?: TrackProperties): void; |
| 301 | screenView(path: string, properties?: TrackProperties): void; |
| 302 | screenView( |
| 303 | pathOrProperties?: string | TrackProperties, |
| 304 | propertiesOrUndefined?: TrackProperties |
| 305 | ): void { |
| 306 | if (this.isServer()) { |
| 307 | return; |
| 308 | } |
| 309 | |
| 310 | let path: string; |
| 311 | let properties: TrackProperties | undefined; |
| 312 | |
| 313 | if (typeof pathOrProperties === 'string') { |
| 314 | path = pathOrProperties; |
| 315 | properties = propertiesOrUndefined; |
| 316 | } else { |
| 317 | path = window.location.href; |
| 318 | properties = pathOrProperties; |
| 319 | } |
| 320 | |
| 321 | if (this.lastPath === path) { |
| 322 | return; |
| 323 | } |
| 324 | |
| 325 | this.lastPath = path; |
| 326 | super.track('screen_view', { |
| 327 | ...(properties ?? {}), |
| 328 | __path: path, |
| 329 | __title: document.title, |
| 330 | }); |
| 331 | } |
| 332 | |
| 333 | async flushRevenue() { |
| 334 | const promises = this.pendingRevenues.map((pending) => |
no test coverage detected