plugin/google_analytics.rb in tdiary-contrib-4.2.0 vs plugin/google_analytics.rb in tdiary-contrib-4.2.1
- old
+ new
@@ -11,18 +11,17 @@
end
def google_analytics_insert_code
return '' unless @conf['google_analytics.profile']
<<-HTML
- <script type="text/javascript"><!--
- 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("UA-#{h @conf['google_analytics.profile']}");
- pageTracker._trackPageview();
- } catch (err) {}
+ <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', 'UA-#{@conf['google_analytics.profile']}', 'auto');
+ ga('send', 'pageview');
// --></script>
HTML
end
# UA-53836-1