Question

I installed Sija's fork of garb and am having some issues. The documentation appears to be a bit outdated as some things have been deprecated.

I have the following code (ignore the fact that it's horribly unsecure):

extend Garb::Model
metrics :pageviews
dimensions :page_path

Garb::Session.login('XXXXXX@gmail.com', 'mypassword')
profile = Garb::Management::Profile.all.detect { |p| p.web_property_id == 'UA-XXXXX-1' }
puts profile.visits

When I run this, I get undefined method visits. I also tried this code on StackOverview, and it returned undefined method results. I'm guessing these are due to the new GA Management API v3 changes, but does anyone know the new way to access pageviews/visits?

I'm trying to query pageviews by date in the end.

Thanks for any help!

Was it helpful?

Solution

You need to create a class extending Garb::Model (https://github.com/Sija/garb#define-a-report-class). Btw, documentation has been updated to work with the newest version of the gem.

OTHER TIPS

Here is an example:

class Report 
  extend Garb::Model

  metrics     :pageviews
  dimensions  :pagePath 
end

Edit: Thanks for the edit! That was my first ever post :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top