Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

need to know how to get all keywords from Google Keywords service. By default, i can download only 700 keywords. How to get all keywords from one query? Thanks.

share|improve this question
1  
Which keywords service do you mean? Is it the AdWords keyword tool? –  Ewan Heming Mar 21 '11 at 11:50
    
Right, AdWords keyword tool. –  user3070 Mar 22 '11 at 14:17
    
Who can help me? –  user3070 Mar 27 '11 at 7:16
add comment

1 Answer

Auto-Pagination through the API

Here is a quick overview on how to do auto-pagination with our API. You might also follow along by checking the fully working sample code in Python which you can use in your own applications.

The following sample query fetches the first 10,000 keywords by conversion rate for the month of February:

https://www.google.com/analytics/feeds/data
?ids=ga:12345
&dimensions=ga:keywords
&metrics=ga:conversionRateAll
&sort=-ga:conversionRateAll
&start-date=2011-02-01
&end-date=2011-02-28
&start-index=1
&max-results=10000

Notice how start-index is set to 1 and max-results is set to 10,000. When this query is issued to the API, the API will return up to 10,000 results. The API also returns the number rows found in Google Analytics in the openSearch:totalResult XML element

14,654

To get the total number of pages in this request, we can use the following python code:

num_pages = math.ceil(total_results / 10000)

Then getting the start-index for each additional page is trivial:

for page_number in range(num_pages)[1:]: # skips the first page.
start_index_for_page = page_number * 10000 + 1

Thats it! If you want to start doing this today, or just see how it should work, we’ve included a fully working example. If you liked this, and want to see more example, let us know what we should do next in our comments.

Posted by Nick Mihailovski, Google Analytics API Team

share|improve this answer
    
is it for google analytics or is it for google adwords? –  user3070 Mar 29 '11 at 11:15
    
@user3070 - The above feed uses the Analytics API, but there is an API for Google AdWords too. –  David Harkness Mar 30 '11 at 21:52
    
can you give quick overview for Google Adsense Keyword service? –  user3070 Apr 26 '11 at 6:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.