Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>So, this is my understanding of what you're doing:</p> <p>You're setting page-level custom variables (important technical note: these need to be called before the _trackPageview or some other call, else they won't be tracked.) </p> <p>Your code might looks something like this:</p> <pre><code>_gaq.push(['_setCustomVar', 2, 'Brand', 3]); </code></pre> <p>Now, when querying the Google Analytics API, its important to note that the slot # is very important, since the slot you're accessing is explicitly named in the query. </p> <p>So, to do this, you'd need to set your dimensions to <code>ga:customVarName2</code> and <code>ga:customVarValue2</code>, and decide what metric you're interesting it getting. You mention Page views, so you'd use <code>ga:pageviews</code>. (You're by no means limited to pageviews. You can use any Metric besides a couple of the AdWords specific ones.)</p> <p>This query would return you all of the custom variable from this slot, and the number of pageviews associated with them.</p> <p>You also mentioned you'd want to be able to filter by value.</p> <p>You'd do that by setting the filter value to something like <code>ga:customVarValue2==Apple</code>. </p> <p>You can see what a query like that <a href="http://code.google.com/apis/analytics/docs/gdata/gdataExplorer.html?dimensions=ga%253AcustomVarName2%252Cga%253AcustomVarValue2&amp;metrics=ga%253Apageviews&amp;filters=ga%253AcustomVarValue1%253D%253DApple&amp;start-date=2011-01-16&amp;end-date=2011-01-30&amp;max-results=50" rel="nofollow noreferrer">would look like here in the query explorer</a>.</p> <p>Here's a sample screenshot: <img src="https://i.stack.imgur.com/sdJlc.png" alt="enter image description here"></p> <p>Finally, all Google Analytics API queries by default require you to set a date range, so you could query that on your own. </p> <p>All you need to do is decide <a href="http://code.google.com/apis/analytics/docs/gdata/gdataLibraries.html" rel="nofollow noreferrer">which library</a> you want to use as interface, and you're set to go. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload