The 10 most viewed pages by country

902 views
Skip to first unread message

hd

unread,
Jul 27, 2010, 10:29:02 AM7/27/10
to google-analytics-api - GA Data Export API
Hi
I'm trying to get the 10 most viewed pages by country. So, I've got

'&dimensions=ga:country,ga:pagePath' +
'&metrics=ga:pageviews' +
'&sort=ga:country,-ga:pageviews'

which works fine in that I get all the countries, pages and the
pageviews. The trouble is with over 1000 pages that would give me a
huge list. I just want the top 10 for every country. How would I do
that? One way would be to filter for each country and limit the result
to 10 but that would mean 195 different queries.

mike3s

unread,
Jul 27, 2010, 11:46:24 PM7/27/10
to google-analytics-api - GA Data Export API
simply add '&max-results=10' to the query

Nick

unread,
Jul 28, 2010, 1:40:25 PM7/28/10
to google-analytics-api - GA Data Export API
Hi,

To do this, you need to write a program that first gets a list of all
the countries GA reports on. Then for each country, query the API for
the top 10 pages using the country retrieved in the original query as
a filter.

-Nick

mike3s

unread,
Jul 30, 2010, 3:57:06 PM7/30/10
to google-analytics-api - GA Data Export API
geez, I read that wrong, sorry.

Nick basically said - yes, upto 195 different queries...

An alternative, assuming you have a number of countries with minimal/
meaningless activity, might be to decide on a lower threshold where
the number of page views is too small to matter, say 10, and then do
the big query filtered by pageviews>10. That will significantly reduce
the number of rows in the results and it will likely be a lot faster
in the end. 100+ queries is going to take a noticeable time...even if
the results of each one is small.

maybe even combine the techniques - do a quick query ot total
pageviews by country, elimitate any below a threshold, and then query
only the countries that have significant traffic.
> > to 10 but that would mean 195 different queries.- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages