fix: align gtm page view payload

This commit is contained in:
Benjamin Lu
2026-01-24 19:45:52 -08:00
parent ef1c55b1f6
commit c43d4aa5f7

View File

@@ -36,15 +36,14 @@ function getBasePath(): string {
const basePath = getBasePath() const basePath = getBasePath()
function pushPageView(to: RouteLocationNormalized): void { function pushPageView(): void {
if (!isCloud) return if (!isCloud) return
const dataLayer = window.dataLayer ?? (window.dataLayer = []) const dataLayer = window.dataLayer ?? (window.dataLayer = [])
dataLayer.push({ dataLayer.push({
event: 'page_view', event: 'page_view',
page_location: window.location.href, page_location: window.location.href,
page_title: document.title, page_title: document.title
page_path: to.fullPath
}) })
} }
@@ -105,8 +104,8 @@ installPreservedQueryTracker(router, [
} }
]) ])
router.afterEach((to) => { router.afterEach(() => {
pushPageView(to) pushPageView()
}) })
if (isCloud) { if (isCloud) {