halfdan / piwik-ruby-tracking

A Ruby Gem that allows you to add the Piwik Tracking Code to Sinatra, Padrinorb and Rails
MIT License
52 stars 33 forks source link

Is it working with Rails 3.1.1? #3

Closed szymon-przybyl closed 12 years ago

szymon-przybyl commented 12 years ago

I've added piwik_analytics to my gemile and configured it in config/initializers/piwik_analytics.rb as follows:

PiwikAnalytics::Config.id_site = 1 
PiwikAnalytics::Config.url = 'http://est.megiteam.pl'
PiwikAnalytics::Config.use_async = true

But I don't see any script included in rendered html's, and when I visit page, nothing happens to piwik stats, so it looks like it is not working. I'm using rails 3.1.1

halfdan commented 12 years ago

Can you give me an example application for that?

halfdan commented 12 years ago

Also note that the gem uses </body> as anchor, make sure you have that in your application layout.

szymon-przybyl commented 12 years ago

In my application layout before or after rendering? I have layout in slim. And in which layout, only application, or all layouts?

halfdan commented 12 years ago

That's actually a good question. I haven't tested the gem with alternative markups. I'll look into it and provide a bug fix if necessary. You only need it once, so in the application layout is sufficient as it always gets rendered.

berkes commented 12 years ago

Would it not be a good idea to allow people to pull piwik code from their views?

render piwik_tracking_tags

This would add some coupling, but it also adds some flexibility. Like for people who use HAML, Slim etceteras.

halfdan commented 12 years ago

@berkes, yes definitely. I haven't had the time yet to schedule a new release, but I will try to release the next version of piwik_analytics soon(ish).

halfdan commented 12 years ago

Fixed and rewritten in v1.0.0

@berkes you can use <%= piwik_tracking_tag %> from now on.