Tuesday, 14 September 2010
Facebook StumbleUpon Twitter Google+ Pin It

Increase your productivity with the Google Analytics API

(Cross-posted from the Google Analytics Blog)

Back in Episode 10 of Web Analytics TV, (32:00), Lisa C from Melbourne asked how to pull a trending report from Google Analytics for the top organic search landing pages. This was such a great question, that we wrote 2 articles and released sample code describing how you can automate retrieving this data from Google Analytics Data Export API. But first let’s look at the results.

Here is a graph plotting traffic to the top 100 landing pages for organic search for all of June for www.googlestore.com.

Let’s Analyze:
This is the typical trend graph you can find across the Google Analytics web interface. By itself, all you can tell is that something happened during the spike. what you can’t figure out is which page actually increased in traffic; to do so would require lots more digging.

Now let’s try again:
Here is a stacked area graph of each of the top 100 landing pages for organic search.

Let’s Analyze:
Awesome right! So obvious why this is cooler. But let me explain.

Lisa’s graph, above, presents significantly simplified insights. Notice how much more we can get from this graph. We can see the green page is what caused the big spike. Also we see that the blue and orange pages had interesting changes in traffic patterns; changes we couldn’t identify from the graph on the left. Being able to break down the totals graph is indeed a gold mine for analysis.

Typical actions you, or Lisa (!), can take from this data are to get the organic search keyword to send traffic to the blue page. Then to identify the keywords sending traffic to the green and orange page and see if we can increase traffic to other pages.

Exporting the Data from the web interface:
Anybody can pull this data from the Google Analytics web interface. You simply create a custom report with landing pages and entrances. Then drill into each landing page, and export the data to a csv file. Finally you go through all csv files and compile them into a single file for analysis. Let's illustrate:

Going through each report individually is a LOT of manual work, but we can automate all of this using the Data Export API; reducing hours of work into a few minutes!

Using the Data Export API to Automate:
In part one of our series, we demonstrate how to use the Data Export API to automate the exact task above. A user specifies 1 query to determine the top landing pages. The for each landing page, a separate query is used to get the data over time.

This is great and we built it to work with any query with a single dimension. But notice that the number of queries grows with the number dimensions. In fact this program requires n + 1 queries so if you want data for 1,000 dimensions, it will take 1,001 queries.

This is bad because there is a daily quota of 10,000 queries for the Data Export API. So if you ran this program 10 times, with 1,000 dimensions, it would require 10,010 queries completely using your quota. ouch!

Optimizing Data Export API Requests:
To reduce the number of queries requires, the second part of this series describes an alternate approach to retrieving the same data, but minimizes the number of queries required. In the second approach, we use Data Export API filter expressions to return data for multiple dimensions in each request.

This approach dramatically reduces the amount of quota required. In the best case, only 2 queries are required.

Using this second approach, analysts can now run this report to their hearts content. They can do this for different time frames, and different dimensions, comparing organic vs paid traffic, trends of keywords by search engine, even compare traffic by geography.

As we mentioned, we wrote two articles describing both approaches and released the sample code for the application. Let us know the amazing insights you find through using this tool.

Have fun!

No comments: