Content Drilldown with the Google Analytics Core Reporting API

Wednesday, 17 December 2014

Today I’ve been trying to replicate the content drilldown function from Google Analytics through their Core Reporting API. The solution I came to requests pagePathLevel# in the dimension, and then filters on various pagePathLevel#:

For example if you wanted to the page views for the content drilldown at /level1/level2/level3 you could run this:

id=ga:#######
metrics=PageView, Sessions, etc
sort=-ga:page views
start-date=2014-11-16
end-date=2014-12-16
filters=ga:pagePathLevel1==/level1/;ga:pagePathLevel2==/level2/dimensions=ga:pagePathLevel3

A handy tool to test these queries is the Google Analytics Query Explorer.

In my case I wanted to get a list of the most popular exhibitions at the V&A. The URL structure is: content/exhibitions/[expo-slug], so the query I am running is:

id=ga:#######
dimensions=ga:pagePathLevel3
metrics=ga:pageviews
filters=ga:pagePathLevel1==/content/;ga:pagePathLevel2==/exhibitions/
sort=-ga:pageviews
start-date=2014-11-1
end-date=2014-12-16
max-results=50

Right now, Constable and Horst are top of the list!

Hopefully this will help someone else.

Post changelog

Back to all posts