Google Analytics - Query User-Level Data without Client ID or User ID

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce tellus odio, dapibus id fermentum quis, suscipit id erat. Mauris metus. Maecenas aliquet accumsan leo. Fusce tellus. Duis pulvinar. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Duis pulvinar.

This is a somewhat complicated method of getting user data, but you can do it immediately begin using it in most cases without having to collect new data first. Basically, you just use dimensionality to get around the limitations of Google's API to determine an individual session. You're able to query 7 dimensions in a single query. So, your goal would be to create a query that gets a unique user's session by combining various dimensions. For example, you might query: hour, minute, landing page, country, region, city, and page. The first 6 dimensions are session-scoped (ie: session-level data), and the last one is hit-scoped (ie: the pageview). So, each row will be a hit that also has the session info.

If any users overlapped on this exact thing, you'd get some conflicts. So, if you're using this method - you may have some occasional overlap that could cause weird results in an analysis. You could pull the session info only, with "users" and that'll tell you when a session had multiple users. You could use this information to exclude these people from your data set since it's not indicitive of an individual person.

Here's how to do it...

1.) Experiment using a few different queries switching around the dimensions. Focus on dimensions with high variation - like city, and time. Hour, for example, has 24 different options. City has hundreds, and minute has 60. Browser might be a poor choice, since most people only use 4 different browsers. You can use the Google Analytics Query Explorer for quick prototyping. Note - using "date" as I did here in the snip is redundant if you end up processing this in R - so, use that slot for an additional dimension.



2.) A winning combination is when you see the number of rows returned that is similar to the pageviews for a single day in Google Analytics.

Query Explorer Results:


Google Analytics Data:


3.) Once you've confirmed the data looks okay (in this case, I get 2953 from the query, and 2968 in Google Analytics - close enough), you're all done!

Back To Blog

Google Maps