(path?: string)
| 17 | }; |
| 18 | |
| 19 | export const getAdPageViewId = (path?: string): string | undefined => { |
| 20 | if (typeof window === 'undefined') { |
| 21 | return undefined; |
| 22 | } |
| 23 | |
| 24 | const url = new URL(path ?? window.location.href, window.location.origin); |
| 25 | const entry = `${getHistoryEntryKey()}:${url.pathname}${url.search}`; |
| 26 | if (pageView?.entry !== entry) { |
| 27 | pageView = { entry, id: generatePageViewId() }; |
| 28 | } |
| 29 | |
| 30 | return pageView.id; |
| 31 | }; |
no test coverage detected