Merged in feat/tracking-sessionId (pull request #1653)
Feat(tracking): add sessionId to all events. Fixed some invalid session bugs * Feat(tracking): add sessionId to all events. Fixed some invalid session bugs Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -1,6 +1,17 @@
|
||||
import { SESSION_ID_KEY_NAME } from "@/hooks/useSessionId"
|
||||
|
||||
export function trackEvent(data: any) {
|
||||
if (typeof window !== "undefined" && window.adobeDataLayer) {
|
||||
data = { ...data, siteVersion: "new-web" }
|
||||
let sessionId = ""
|
||||
|
||||
try {
|
||||
sessionId = sessionStorage.getItem(SESSION_ID_KEY_NAME) ?? ""
|
||||
} catch (e) {
|
||||
console.error("Error getting sessionId from sessionStorage", e)
|
||||
}
|
||||
|
||||
data = { ...data, siteVersion: "new-web", sessionId }
|
||||
|
||||
window.adobeDataLayer.push(data)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,7 @@ export function trackPageViewStart() {
|
||||
}
|
||||
|
||||
export function trackPageView(data: any) {
|
||||
if (typeof window !== "undefined" && window.adobeDataLayer) {
|
||||
window.adobeDataLayer.push(data)
|
||||
}
|
||||
trackEvent(data)
|
||||
}
|
||||
|
||||
export function createSDKPageObject(
|
||||
|
||||
Reference in New Issue
Block a user