开发者

Where to put getclicky code in a rails3 app

开发者 https://www.devze.com 2023-04-12 21:38 出处:网络
I want to use getclicky to monitor my websites statistics. Here is the following code snipet: <a title=\"Google Analytics Alternative\" href=\"htt开发者_Python百科p://getclicky.com/66457219\">

I want to use getclicky to monitor my websites statistics.

Here is the following code snipet:

<a title="Google Analytics Alternative" href="htt开发者_Python百科p://getclicky.com/66457219"><img alt="Google Analytics Alternative" src="//static.getclicky.com/media/links/badge.gif" border="0" /></a>
<script src="//static.getclicky.com/js" type="text/javascript"></script>
<script type="text/javascript">try{ clicky.init(66490659); }catch(e){}</script>
<noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/66490659ns.gif" /></p></noscript>

Does it go in the head of the layout or the body of the layout or do I have to put it on each page?


From the getclicky FAQ:

The tracking code needs to go on every page that you want us to track. Most sites have what's called a "footer" file, that's automatically included at the bottom of every page. If your site has one of these (and if it doesn't, it should!), all you need to do is place the code in this one file and the code will then be included at the bottom of every page on your site automatically.


Create a _footer.html.haml (or .erb depending on your app) file in app/views/layouts and include it in every layout at the bottom. like so:

= render :partial => 'layouts/footer'
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号