Using garb (http://github.com/vigetlabs/garb) i need to fetch the same Map Overlay XML, like Google Analytics web interface export provides. How it can be done?
Garb::Session.login("email@gmail.com", "pwd")
profile = Garb::Profile.all.first
profile.visits
+
class Exits
extend Garb::Model
metrics :pageviews, :visitors, :visits
di开发者_StackOverflow社区mensions :request_uri
end
...works fine.
But i really cannot get what should i do next to get xml with geodata (city + lon/lat).
Thanks!
This should get you in the right direction: http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDimensionsMetrics.html#ga:latitude
These are dimensions, so you could get the number of pageviews or visits for a combination of lat/lng.
Rendering on a map is not something handled by Garb, just to be clear. Garb is only useful for exporting data from the API.
If you're using Garb with Rails and you're extending an active record object you should be able to call to_xml on that object. To use garb with AR, simply extend the class and set the instance class you want to use with Garb. https://github.com/vigetlabs/garb/wiki/With-an-ORM
精彩评论