Maximum call stack size exceeded
See original GitHub issueDescription
My Vue app become inaccessible if I pass the router object as the third argument
Vue.use(VueGtag, {
config: { id: "UA-1234567-1" }
}, router);
Expected behavior
It should let users add vue router, so that GA doesn’t only track the default ‘/’ path for every page view.
Actual behavior
But instead it throws this error
Maximum call stack size exceeded
at Function.assign (<anonymous>)
Environment
Running npm ls vue-gtag returns `-- vue-gtag@1.9.0
OS: Windows 10 Browser: Google Chrome: Version 85.0.4183.83
Reproducible Demo
I googled this issue and it turns out it may be a caused due to circular reference within vue components. My Vue app is ready and it consists of 100’s of components, it is impossible to find out the circular reference (if there’s any) without checking each and every component one by one. For a quick fix, I am setting the page view manually with
this.$gtag.pageview({ page_path: this.$route.path });
in mounted() method of App.vue
Suggestion
As most people will use this package at the end of any vue project. It would be really helpful , if you can somehow manage to help us spot the file/vue-component/route causing this issue. Otherwise, it would be total nightmare for big projects.
Thanks for reading.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (4 by maintainers)

Top Related StackOverflow Question
@snickbit judging by the example u made, you have to pass the router as a third argument in the
usemethod, not as a property of the second argument. I get that is confusing and that’s why in the next version of vue-gtag for vue 3, this has changed to make it easier to implementThanks. It was solved