Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Google Tag Manager and SveletKit don't catch History Change event

$
0
0

I install gtm.js to my routes/+layout.svelte

<script lang="ts">  // @ts-nocheck  import { PUBLIC_TAG_ID } from "$env/static/public";  import { onMount } from "svelte";  onMount(() => {    window.dataLayer = window.dataLayer || [];    window.dataLayer.push({"gtm.start": new Date().getTime(),      event: "gtm.js",    });    const gtmScript = document.createElement("script");    gtmScript.src ="https://www.googletagmanager.com/gtm.js?id=" + PUBLIC_TAG_ID;    document.head.append(gtmScript);  });</script><a href="/">Home</a><slot />

Most events are caught except History Change:

enter image description here

I tried installed using the suggested code snippet by gtm.js to app.html but it's same 😥


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>