sharieswebsite/lib/analytics.rb
Yann Esposito (Yogsototh) dbcd7054a3 Google Analytics
2011-05-14 17:30:44 +02:00

41 lines
1.7 KiB
Ruby

# All files in the 'lib' directory will be loaded
# before nanoc starts compiling.
def genAnalytics
%{<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-10612400-2");
pageTracker._trackPageview();
} catch(err) {}</script>}
end
def clicky_analytics
clickyid=66374971
%{<script type="text/javascript">
var clicky = { log: function(){ return; }, goal: function(){ return; }};
var clicky_site_id = #{clickyid};
(function() {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = ( document.location.protocol == 'https:' ? 'https://static.getclicky.com/js' : 'http://static.getclicky.com/js' );
( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );
})();
</script>
<noscript><p><img alt="Clicky" width="1" height="1" src="http://in.getclicky.com/#{clickyid}ns.gif" /></p></noscript>
}
end
def user_voice
return %{ <script type="text/javascript">
(function() {
var uv = document.createElement('script'); uv.type = 'text/javascript'; uv.async = true;
uv.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'widget.uservoice.com/JgOrVPRCzoip6TmO9Rkbw.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(uv, s);
})();
</script>}
end