Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3843700
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:58:31+00:00 2026-05-19T15:58:31+00:00

Edit refurbished the question that was not clear New to GA, I’m looking at

  • 0

Edit refurbished the question that was not clear

New to GA, I’m looking at the way to retrieve automatically custom variables data statistics

The query would have

  • a start and an end dates (possibly equal)
  • a variable name

For instance, a Page-level variable Brand takes only three possible values, that are set by the web server, and seen by the client.
The values are Apple, Google and Microsoft.

The query to Google-Analytics could be something like (pseudo-code), provided that I use an authentication token previously acquired

  ...getstatistics?myToken=123&variable=Brand&datefrom=20110121&dateto=20110121

And the result could be some xml like data

  <variable>Brand</variable><value>Apple</value><count>3214</count> 
  <variable>Brand</variable><value>Google</value><count>4321</count> 
  <variable>Brand</variable><value>Microsoft</value><count>1345</count> 

Meaning for instance that the page-level custom variable Brand was set to the value Apple by the web server (and thus seen by the client / sent to GA) 3214 times.

What is the correct way/protocol to query values/statistics from GA, in order to get statistics related to custom variables?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T15:58:32+00:00Added an answer on May 19, 2026 at 3:58 pm

    So, this is my understanding of what you’re doing:

    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.)

    Your code might looks something like this:

    _gaq.push(['_setCustomVar', 2, 'Brand', 3]);
    

    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.

    So, to do this, you’d need to set your dimensions to ga:customVarName2 and ga:customVarValue2, and decide what metric you’re interesting it getting. You mention Page views, so you’d use ga:pageviews. (You’re by no means limited to pageviews. You can use any Metric besides a couple of the AdWords specific ones.)

    This query would return you all of the custom variable from this slot, and the number of pageviews associated with them.

    You also mentioned you’d want to be able to filter by value.

    You’d do that by setting the filter value to something like ga:customVarValue2==Apple.

    You can see what a query like that would look like here in the query explorer.

    Here’s a sample screenshot:
    enter image description here

    Finally, all Google Analytics API queries by default require you to set a date range, so you could query that on your own.

    All you need to do is decide which library you want to use as interface, and you’re set to go.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit (updated question) I have a simple C program: // it is not important
EDIT: Simple version of the question: I want to create server variables in the
EDIT: Sorry about ellipsis that's not what I actually have. For declaring an array
EDIT: I rephrased the question because I have not explained well. Let's see if
Edit: The below question was answered by this . I have a new updated
Edit: I'm looking for solution for this question now also with other programming languages.
Edit: From another question I provided an answer that has links to a lot
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
EDIT: looking for this: http://diminishing.org/extending-formtastic-with-a-sprinkle-of-jquery (If this works I'll answer my own question) I've
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.