How to send the first view? [SSR][bootstrap=false]
See original GitHub issueHi @MatteoGabriele ,
I’m struggling to send the first view when reaching my website.
All following $router.push will be catched by vue-gtag (I can see them inside GTM Debug Chrome extension), but the first one is not. I’m wondering if it could come from the fact I use server-side rendering, however the script seems loaded when I call bootstrap():

I also tried to set bootstrap: true so there is an immediate activation, but that’s the same.
I’m not using Nuxt.js but the “raw” Vue SSR (often with entry-client.js and entry-server.js), if you have any idea what could be the cause, it would be great 👍
Thank you,
EDIT: It seems when doing
params: {
send_page_view: true,
},
the library catches the first one too. I knew it was in the docs but when trying earlier it was not working hmmm… Don’t know what could have be in conflict (cache or other?). It catches in a different format (http://localhost/home instead of /home for the following page changes), but that’s maybe the normal behavior.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)

Top Related StackOverflow Question
This works as a workaround for the first view:
I’m having a related problem. The host page for my app (including the
<script>include for the Gtags library) is rendered serverside. I have awindow.onloadevent handler that tells my Vue app to bootstrap the analytics module which in turn callsbootstrapin vue-gtag.I’ve noticed that even with
send_page_view: truein my params the first view event isn’t being sent to GA. I’ve checked thedataLayerobject and I can’t see any network traffic.Debugging it with some
console.logstatements in a copy ofvue-gtag@1.10.0I can see that when the RoutersonReadyhandler is invoked the value ofcurrentisundefined. Thus no data can be sent.I don’t know if it’s a fault of the Vue Router (
vue@^2.6.10,vue-router@^3.1.6) or if that’s expected behaviour. Is there a way to check for a current route for the base where vue-gtags is bootstrapped post app initialisation?