MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / screenView

Method screenView

packages/sdks/web/src/index.ts:302–331  ·  view source on GitHub ↗
(
    pathOrProperties?: string | TrackProperties,
    propertiesOrUndefined?: TrackProperties
  )

Source from the content-addressed store, hash-verified

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) =>

Callers 3

constructorMethod · 0.95
eventHandlerMethod · 0.95
testDirectMethodAPIFunction · 0.45

Calls 2

isServerMethod · 0.95
trackMethod · 0.45

Tested by

no test coverage detected