Html hit counter is disrupting my navigation bar links

I thought a hit counter would be simple enough as it’s a pretty basic
piece of code to insert to a html page, however when I add statcounter
to my rails app, all the navigation links break. Can anyone advise me as
to the best way to insert something like this to my app? It works but
when I click on a nav link, it just displays the hit counter on a blank
page unless I reload the page or , if I use the invisible hit counter,
it displays an empty page for whatever nav link I click.

application.html.erb

shopify analytics

Ruth S. wrote in post #1184744:

I thought a hit counter would be simple enough as it’s a pretty basic
piece of code to insert to a html page, however when I add statcounter
to my rails app, all the navigation links break. Can anyone advise me as
to the best way to insert something like this to my app? It works but
when I click on a nav link, it just displays the hit counter on a blank
page unless I reload the page or , if I use the invisible hit counter,
it displays an empty page for whatever nav link I click.

application.html.erb

shopify analytics

If it works when you explicitly reload the page it sounds like your new
javascript might not be playing well with turbolinks.

I’d start looking around there, try disabling turbolinks and see if that
makes a difference…

J