Script for tracking leads not working unless page reloads

Viewed 7

Have a Hubspot script that is used for tracking page views from leads on our site. The tracking code only works when I do an actual page refresh though, which totally defeats the purpose. Is there any way to get this code to be executed when the URL changes?

I currently have it set like this, in the _app.js as a sibling to Component. I did that because otherwise it wouldn't even show up on the page.

<Script type="text/javascript" id="hs-script-loader" async src="//js.hs-scripts.com/xxxxxxxx.js" strategy="beforeInteractive" />

I have also had this in the _document.js file as both a <Script> and as a regular <script> tags. The <Script> didn't load onto the page, and the <script> didn't run unless I refreshed the page.

I have found a bunch of threads discussing this but nothing that helped solve the issue.

0 Answers
Related