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()
function pushPageView(to: RouteLocationNormalized): void {
function pushPageView(): void {
if (!isCloud) return
const dataLayer = window.dataLayer ?? (window.dataLayer = [])
dataLayer.push({
event: 'page_view',
page_location: window.location.href,
page_title: document.title,
page_path: to.fullPath
page_title: document.title
})
}
@@ -105,8 +104,8 @@ installPreservedQueryTracker(router, [
}
])
router.afterEach((to) => {
pushPageView(to)
router.afterEach(() => {
pushPageView()
})
if (isCloud) {