Reputation: 143
I am downloading some data from Google Analytics using Google Api Client for Ruby (my Gemfile.lock sais its google-api-client (0.6.4)). I get data from google but it is so much of it that it comes (or at least it should) in few pages (more than 1000 rows).
I tried to use example from google (part of my code below)
request = {
:api_method => analytics.data.ga.get,
:parameters => {
'ids' => "ga:" + ids,
'start-date' => start_date,
'end-date' => end_date,
'dimensions' => dimensions,
'metrics' => metrics,
'max-results' => 10 #only for testing
}
}
loop do
result = api.execute(request)
results << result
break unless result.next_page_token
request = result.next_page
end
Well... it doesnt work.
result.next_page_token #returns always nil
I am using Analytics API (v3)
Upvotes: 4
Views: 889
Reputation: 2015
I also gone through same thing make it work with following code
loop do
result = api.execute(request)
results << result
next_page_uri = result.data.next_link
break unless next_page_uri
next_page = result.next_page
next_page.uri = next_page_uri
request = next_page
end
Hope this will help to them who is facing same problem
Upvotes: 2