I'm building a pageview counter for my app using the Garb Ruby wrapper for the Google Analytics API. Doing so means creating a new Module in the 'lib' folder, in which I create a class like this:
#lib/Analyze.rb
...
class Report
extend Garb::Resource
metrics :pageviews
dimensions :page_path
filters :page_path.eql => '/' #the path of the page I instantiate this class on
end
#followed by a method for instantiating this class
I need filters :page_path.eql => to be the path of the page in which I call the method. I've tried things like request.request_uri or url_for(:action => 'show' :controllers => 'users' :id => params[:id]) but don't know how to specify the page path in this class definition.