How to properly add GTM or other analytics to client-side routed app? #2470
-
I have a client-side routed website. On page change, GTM doesn't notice it. I am using Vue with Vike router. Where can I find some information? Should I look for Vue GTM integration? (I guess not, since I'm not using the Vue router.) The docs https://vike.dev/integration#analytics didn't help me. It describes a setup with classic server routing. Or, I don't understand the instructions well. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Seems more like a GTM question? Have you tried one of https://vike.dev/hooks such as https://vike.dev/onPageTransitionEnd or https://vike.dev/onAfterRenderClient? |
Beta Was this translation helpful? Give feedback.
-
Meanwhile, I have discovered that we will be using Google Analytics 4 for stats. Fortunately for me, GA4 has built-in detection for browser history changes and correctly recognizes client-side routing as a page view. |
Beta Was this translation helpful? Give feedback.
Seems more like a GTM question? Have you tried one of https://vike.dev/hooks such as https://vike.dev/onPageTransitionEnd or https://vike.dev/onAfterRenderClient?