Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

analytics.html template out of date? (Google analytics) #304

Open
jason-s opened this issue May 3, 2015 · 1 comment
Open

analytics.html template out of date? (Google analytics) #304

jason-s opened this issue May 3, 2015 · 1 comment

Comments

@jason-s
Copy link

jason-s commented May 3, 2015

analytics.html has this:

 var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("{{GOOGLE_ANALYTICS}}");
pageTracker._trackPageview();
} catch(err) {}

but when I signed up for Google Analytics they tell me to use this instead (I replaced ID by {{GOOGLE_ANALYTICS}}:

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', '{{GOOGLE_ANALYTICS}}', 'auto');
  ga('send', 'pageview');

</script>

Which is right?

@jasonrhaas
Copy link
Contributor

I think the first snippet you posted is from the notmyidea theme, right? The theme I'm using (gum) has the latest code, which matches up with your last snippet. I've confirmed that this is working correctly, at least with the gum theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants