Content drilldown through API

1,823 views
Skip to first unread message

Sean Colombo

unread,
Jan 31, 2012, 4:41:47 PM1/31/12
to google-analytics-api - GA Data Export API
Hi,
I posted this question a little over two years ago and didn't get any
responses yet:
http://groups.google.com/group/google-analytics-data-export-api/browse_thread/thread/0c972c53463e08c1

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:
"Hi,
Any plans to add the ability to get Content Drilldown data via the
API?
It appears that crafting a request for ga:pagePath only returns
"real"
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
"ga:pagePath=@specialword"
is not getting any results.
Is there a way to access this with the API that I'm just missing?
Thanks,
- Sean "

Recursively yours,
- Sean

Sean Colombo

unread,
Jan 31, 2012, 6:27:38 PM1/31/12
to google-analytics-api - GA Data Export API
For future reference: it looks like Content Drilldown data is now
available with the ga:pagePath metric, so it's a non issue :)


On Jan 31, 1:41 pm, Sean Colombo <s...@wikia-inc.com> wrote:
> Hi,
> I posted this question a little over two years ago and didn't get any
> responses yet:http://groups.google.com/group/google-analytics-data-export-api/brows...

Aaron Toledo

unread,
Feb 8, 2012, 4:24:45 PM2/8/12
to google-analytics...@googlegroups.com
Hi Sean,

Can you please clarify? I'm still under the impression that pagepath gives you the actual pathname of the page. Did you find an equivalent that gives you folder-level rollups similar to Content Drilldown?

Quentin Caron

unread,
Mar 8, 2012, 7:25:43 AM3/8/12
to google-analytics...@googlegroups.com
Same problem for me. ga:pagePath does give the URL of the page w/o the website / profile root name.

Cheers,
Quentin

The Columbian

unread,
Apr 22, 2012, 10:03:27 PM4/22/12
to google-analytics...@googlegroups.com
Hello,

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
Paige

The Columbian

unread,
Apr 24, 2012, 11:16:33 AM4/24/12
to google-analytics...@googlegroups.com
Hello,

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 ( http://ga-dev-tools.appspot.com/explorer/?csw=1) 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

Nick

unread,
Apr 24, 2012, 12:41:44 PM4/24/12
to google-analytics...@googlegroups.com
Thats great you found both of these tools useful :)

-Nick
Reply all
Reply to author
Forward
0 new messages