Ruby on Rails Thursday, July 28, 2016

Ruth Stephenson 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
>
> <!--
> * Statcounter to monitor visitors, etc to my webapp
> * @reference https://statcounter.com
> -->
>
> <!-- Start of StatCounter Code for Default Guide -->
> <script type="text/javascript">
> var sc_project=11051099;
> var sc_invisible=0;
> var sc_security="0e87dbf6";
> var scJsHost = (("https:" == document.location.protocol) ?
> "https://secure." : "http://www.");
> document.write("<sc"+"ript type='text/javascript' src='" +
> scJsHost+
> "statcounter.com/counter/counter.js'></"+"script>");
> </script>
> <noscript><div class="statcounter"><a title="shopify
> analytics" href="http://statcounter.com/shopify/"
> target="_blank"><img class="statcounter"
> src="//c.statcounter.com/11051099/0/0e87dbf6/0/"
> alt="shopify analytics"></a></div></noscript>
> <!-- End of StatCounter Code for Default Guide -->

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

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2d35e8c7ef4826f62024cf9ee2f04c97%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment