Keyword visits per keyword over date

41 views
Skip to first unread message

portentint

unread,
Jun 2, 2010, 4:16:20 PM6/2/10
to google-analytics-api - GA Data Export API
Hello there,

I'm trying to gather the total visits per keyword over a monthly time
period and the results returned by the API do not seem to match what I
see in GA.

Using a date range of 5/1/2010 - 5/31/2010 and these query
credentials:

query.setDimensions("ga:date,ga:keyword");
query.setMetrics("ga:visits");
query.setMaxResults(Integer.MAX_VALUE);

The results I'm getting back are:
cell phones: 521 (5/2010)
sprint phones: 191 (5/2010)

But the results in GA are:
cell phones: 11,557
sprint phones: 4,871

Another thing I've noticed is that when I print out the total results
sent back, it seems to be capping at 10,000. Is there any reason for
this? I feel like it's missing keyword data.

Thanks in advance!

portentint

unread,
Jun 2, 2010, 5:17:44 PM6/2/10
to google-analytics-api - GA Data Export API
So I've figured out something that has greatly improved my stats since
my last post.
I added a sort parameter: query.setSort("-ga:visits");
This returned the top 10,000 keyword results.

One thing I don't quite understand is why it returns multiple rows for
the same keyword.
For example, it returned like 15 data rows for the keyword 'cell
phones'. I had to add them all up to get the total, which does match.

Is there a way to have the results return one row per keyword with the
correct visits metric?

Nick

unread,
Jun 2, 2010, 5:28:29 PM6/2/10
to google-analytics-api - GA Data Export API
Hi,

It might help looking through the docs.
http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDataFeed.html#maxResults

You can't request more than 10k rows for any request. Also you're
requesting ga:date with ga:keywords. The response you are getting is
total number of keywords per day. You probably want the total number
of keywords across the date range. Try removing the ga:date dimension.

-Nick

portentint

unread,
Jun 3, 2010, 2:35:03 PM6/3/10
to google-analytics-api - GA Data Export API
Thanks for the help Nick. I'm pretty sure I have the visits
calculating correctly now. The key was setting the sort to go by -
ga:visits.

I'm now trying to get the appropriate conversion rate per keyword and
I'm using this combination:
query.setDimensions("ga:keyword");
query.setMetrics("ga:goalCompletionsAll,ga:goalStartsAll,ga:visits");
query.setSort("-ga:goalCompletionsAll");

I found a posting in the google group where someone suggested doing:
ga:goalCompletionsAll / ga:visits

But that isn't lining up with what I see in GA. Neither is:
ga:goalCompletionsAll / ga:goalStartsAll

Am I on the right track?

On Jun 2, 4:28 pm, Nick <api.ni...@google.com> wrote:
> Hi,
>
> It might help looking through the docs.http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDataFe...

Nick

unread,
Jun 3, 2010, 6:10:08 PM6/3/10
to google-analytics-api - GA Data Export API
Hi,

The calculation is indeed ga:ConversionsAll / ga:visits see the docs
on common calculations:
http://code.google.com/apis/analytics/docs/gdata/gdataReferenceCommonCalculations.html#goalConversions

You probably need to ensure the date range is correct, the queries
between the UI and API are the same, you're not hitting confidence
intervals, and you are not summing the paginated results from the API
response but instead using the aggregates table.

-Nick
Reply all
Reply to author
Forward
0 new messages