This message was deleted.
# ask-questions
w
This message was deleted.
this is fine fire 1
h
I know that this is a common issue if your site is SPA (dynamic). Have you implemented this -
Copy code
// Call this every time a navigation event happens in your SPA
function onRouteChange() {
  gb.setURL(window.location.href);
}
c
Yes, not trough onroute, but with GTM setAttribute option, with other variables. Do you think this can be caused by GTM?
h
I know from experience that GTM can cause some issues, but i'm not knowledgable enough to know if it is causing the issue here. I'd feel safer however with doing the implementation in my application though so if you have the possibility to quickly do so to rule it out i'd go for it.
c
It's not a quick solution based on different values we set earlier, and because await function for G Tag as an id, but thank you I will run it.
f
Is it a SPA?
c
Yes, of course, NextJS
f
I can check with team, it shouldn't be firing twice
unless your attributes are changing, which might be the case
c
That's possible, we send id attribute later, because of waiting for gtag api and the url may change before or after that. Let me check on that.
m
that Growthbook sometimes runs the code twice
oh yes,.. we have this issue tooo And some times it does not run when required.
reacting on navigation is pain point ..
123 Views