mirror of
https://github.com/danbee/danbarberphoto
synced 2025-03-04 08:49:07 +00:00
Made the analytics code a partial rather than a helper function.
This commit is contained in:
parent
7fa1b15cfb
commit
71640a214e
@ -1,17 +1,2 @@
|
||||
module ApplicationHelper
|
||||
def google_analytics_js
|
||||
raw "<script type=\"text/javascript\">
|
||||
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-603600-4']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
|
||||
</script>"
|
||||
end
|
||||
end
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<%= google_analytics_js %>
|
||||
<%= render :partial => 'shared/analytics' %>
|
||||
|
||||
</body>
|
||||
|
||||
|
||||
13
app/views/shared/_analytics.html.erb
Normal file
13
app/views/shared/_analytics.html.erb
Normal file
@ -0,0 +1,13 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-603600-4']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user