Skip to content

Commit 542210f

Browse files
committed
Merge pull request ruby-china#360 from lgn21st/master
Update launcher of google-ga
2 parents 33694d0 + 9158f06 commit 542210f

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

app/views/layouts/application.html.erb

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,14 @@
9898
}
9999
</script>
100100
<%= yield :scripts %>
101-
<script type="text/javascript">
102-
var _gaq = _gaq || [];
103-
_gaq.push(['_setAccount', '<%= Setting.google_analytics_key %>']);
104-
_gaq.push(['_setSiteSpeedSampleRate', 100]);
105-
_gaq.push(['_trackPageview']);
101+
<script>
102+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
103+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
104+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
105+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
106106

107-
(function() {
108-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
109-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
110-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
111-
})();
107+
ga('create', '<%= Setting.google_analytics_key %>', 'auto');
108+
ga('send', 'pageview');
112109
</script>
113110
<div class="zoom-overlay"></div>
114111
</body>

0 commit comments

Comments
 (0)