Google Analytics: Mastering Unique Visitors in the Data Export API

Back in January this year, Google launched a massive amount of new data through Data Export API. Now, Google show us how to master this data to make better business decisions, starting with the unique visitors metric."We ask Analytics team members to give us their favorite ways to request and use unique visitor data. Next, […]

Back in January this year, Google launched a massive amount of new data through Data Export API. Now, Google show us how to master this data to make better business decisions, starting with the unique visitors metric.

"We ask Analytics team members to give us their favorite ways to request and use unique visitor data. Next, we translate that into an API query along with screen shots of how the data looks. Finally, we give you a deep link to the query explorer tool so you can make that same API request with your own data right now," stated Google.

(Note: You can do most of these queries using Custom Reports through the Google Analytics web interface.)

Let's Go!

Query example #1: Measuring Total Unique Visitors
Before we start using suggested queries, let's lay the ground work with a very simple query for unique visitors.

https://www.google.com/analytics/feeds/data?ids=<tableId>&metrics=ga:visitors&start-date=2011-01-01&end-date=2011-01-31

This query retrieves the total unique visitors to our site for the month of January.

Here's a sample screen shot of the results:

You can click this link to execute this query with your own data. Simple!

Query example #2: Monthly, Weekly, and Daily Unique Visitors
Ok, the query above was easy. So maybe we want to know how many of these users are active users. Hetal Thakkar, the engineer who implemented the processing logic for this metric, says it's easy with the following query:

https://www.google.com/analytics/feeds/data?ids=<tableId>&dimensions=ga:week&metrics=ga:visitors&start-date=2011-01-02&end-date=2011-02-12

Awesome Hetal! All we need to do is add the ga:week time dimension to get weekly unique visitors or as we say at Google, "7-day actives."

See your own data in the query explorer,

In fact, you can measure active users for other time periods by using ga:year, ga:month, ga:day or even ga:hour instead. This gives you the measure of what advertisers call "reach."

For more query examples, refer this Mastering Unique Visitors in the API Google Analytics blog post.

[tags]web traffic,internet traffic,unique visitors,visitors metric[/tags]