Re: Content drilldown through API

The Columbian Apr 24, 2012 8:16 AM
Posted in group: google-analytics-data-export-api

I decided to answer my own question on this one:

While the GA API documentation mostly deals with the version of the parameters found in URL strings and not the version needed if you are using the Easy Dashboard. Here are some examples that worked in the format for the easy dashboard API (gadash-1.0.js). One of my big sticking points was the filters. I was not sure from the docs what the syntax was and a lot of the first things I tried resulted in errors.

For what a base query is, go to the Google Analytics Easy Dashboard Javascript Library and look at the "cool demo!"

Here is a working example of a "base" query for a chart on my page (this query will be used to draw two charts)

var $API_KEY = '';
 var $CLIENT_ID = '';
 var $TABLE_ID = '';

var weblogsBaseConfig = {
    'last-n-days': 30,
    'query': {
 'ids': $TABLE_ID,  
      'metrics': 'ga:pageviews',
 'filters': 'ga:pagePath=~^/weblogs/blazerbanter/$|^/weblogs/gregjayne/$|^/weblogs/highschoolsports/$|^/weblogs/outdoors\-blog/$',

This is the configuration for the PIE chart that uses the base query above with alterations in the chart itself:

// Weblog Pie Chart
  var weblogsPieConfig = {
'divContainer': 'weblogsPie',  // the DIV where the chart will render (REQUIRED)  
    'type': 'PieChart',
'query': {
 'dimensions' : 'ga:pagePath',
      'sort': '-ga:pageviews'
    'chartOptions': {
       height: 400,
       title:'Weblogs: < 30 days'

Here is another example of a filter:  'filters': 'ga:eventCategory==Article Category Tracking;ga:eventLabel=@sports',

I found the query tool ( to be very helpful in figuring out how to migrate existing GA Reports into the new Dashboard API.
I hope that someone finds this useful.

Paige Scott
The Columbian

On Sunday, April 22, 2012 7:03:27 PM UTC-7, The Columbian wrote:

I am using the API through a dashboard (Thanks Nick) and replicating some existing GA reports VIA the API. 

Almost all of the reports were created in GA VIA the content drilldown and I understand that the metric: ga.PagePath is supposed to allow me to reach the same data. I am uncertain of the verbiage to use. I have tried a few things but need an example to work from. I have created the reports in GA and made them into widgets on my GA dashboard> The metric is pageviews and the dimensions listed are page path level 1 exactly matching /news/ and page path level 2 exactly matching /sports/

The URL of the report page has the following verbiage:  pagePathLevel1%3A%2Fnews%2F%2Canalytics.pagePathLevel2%3A%2Fsports%2F/   I have tried ga:pagePathLevel1 and 2 with no results.

Problem is in the reference, I don't see a dimension named either of those, only  ga:pagePath  with no example or idea how to specify. I can use a filter and a regular expression but I was hoping that I could do this report/s in a more straightforward way since the API and the GA web interface talk to the same data. 

Many Thanks

On Tuesday, January 31, 2012 1:41:47 PM UTC-8, Sean Colombo wrote:
I posted this question a little over two years ago and didn't get any
responses yet:

In the interim, I was able to just write a screenscraper to log in to
GA and export the report to a CSV, but since the recent changes to
GA's interface, this is proving to be quite tricky.

Does anyone have a solution for getting Content Drilldown data,
preferably via the API?

Original post:
Any plans to add the ability to get Content Drilldown data via the
It appears that crafting a request for ga:pagePath only returns
page URLs and not the custom data that can be made to show up in the
Content Drilldown section of the web ui.  The data I'm referring to
(that isn't showing up in the Data Feed Query Explorer) was added
using "urchinTracker('/specialword/custom/here');"
Querying for ga:pagePath and filtering with
is not getting any results.
Is there a way to access this with the API that I'm just missing?
 - Sean "

Recursively yours,
 - Sean