Queries with Custom Variable that have no traffic

1,556 views
Skip to first unread message

Telman Yusupov

unread,
Mar 7, 2012, 2:45:40 PM3/7/12
to google-analytics...@googlegroups.com
Hello Nick,

I’ve noticed the following behavior when requesting data with Custom Variables:

The resultset of a query with CV dimensions is an intersection of the rows where CV values are not null. If there is no data for a requested CV, then the whole resultset is null. This is different from behavior for other, non-CV dimensions where null data is not dropped but shown as “(not set)” value.

My question:
  How we can get queries with CVs in them behave in the same way as queries without them?

The issue is best illustrated by a series of simplified examples:

Scenario 1
- We have setup one CV
- On March 1, we had 100 visits in total, 15 of those used CV
- On March 2, we had 150 visits, with no CV used

Query 1
Dimensions: ga:date
Metrics: ga:visits
Start-Date=End-Date: March 1
Result: {ga:date March 1, ga:visits 100}

Query 2
Dimensions: ga:date,ga:customVarValue1
Metrics: ga:visits
Start-Date=End-Date: March 1
Result: {ga:date March 1, ga:customVarValue1 CV1,  ga:visits 15}

When querying against non-CV dimensions for which we have no traffic (i.e. ga:adGroup as we don’t use AdWords), we see that there was no data for the requested dimension, but the total number is reported correctly as shown in Query 3:

Query 3
Dimensions: ga:date,ga:adGroup
Metrics: ga:visits
Start-Date=End-Date: March 1
Result: {ga:date March 1, ga:adGroup (not set), ga:visits 100}


However, this is not behavior we get with a query that has CV in it:

Query 4
Dimensions: ga:date, ga:customVarValue1
Metrics: ga:visits
Start-Date=End-Date: March 2
Result: { } – nothing, no data returned at all

Expected result for Query 4 is:
  {ga:date March 2, ga:customVarValue1 (not set), ga:visits 150}


Finally, the scenario with more than one CV:

Scenario 2
- We have setup two CV
- On March 1, we had 100 visits in total, 15 of those used CV1, 20 used CV2 and 8 used both CV1 and CV2 and the rest had no CVs.


Query 5
Dimensions: ga:date, ga:customVarValue1, ga:customVarValue2
Metrics: ga:visits
Start-Date=End-Date: March 1
Result: {ga:date March 1, ga:customVarValue1 CV1,  ga:customVarValue2 CV2,  ga:visits 8}

The correct result is:
{
ga:date March 1, ga:customVarValue1 CV1,  ga:customVarValue2 CV2,  ga:visits 8
ga:date March 1, ga:customVarValue1 CV1,  ga:customVarValue2 (not set),  ga:visits 7
ga:date March 1, ga:customVarValue1 (not set),  ga:customVarValue2 CV2,  ga:visits 12
ga:date March 1, ga:customVarValue1 (not set),  ga:customVarValue2 (not set),  ga:visits 73
}

Thank you very much in advance for your help,

Telman Yusupov

Nick

unread,
Mar 7, 2012, 3:06:21 PM3/7/12
to google-analytics...@googlegroups.com
Hi,

So this is a fundamental concept of how Google Analytics works today. GA calculates the values of dimensions and metrics for each hit. These values are then used to update rows of tables you see in the reports. If any of the dimensions do not have a value, the entire row is not added to the table.

For some dimensions, GA uses the default value of (not set).
Custom Variable do not have a default value, so if a hit does not have a custom variable associated with it, all the other dimensions in the query are not added to the reports.

If you need to see the (not set) value, you could try sending a default value for custom variables.

For example if you use visitor level custom vars to track member vs non-member, you should always set non-member as a default for everybody; then modify to member once they register.

Hope that helps.
-Nick

Telman Yusupov

unread,
Mar 7, 2012, 3:29:07 PM3/7/12
to google-analytics...@googlegroups.com
Thank you very much for a prompt reply - much appreciated!

Supplying a default value for a CV explicitly (going forward) is a sensible workaround and I'll pass it along to the team.

This was somewhat suprising to me:


" If any of the dimensions do not have a value, the entire row is not added to the table."


I hoped that no rows are actually discarded and we could somehow get to the CV dimensions with no values (we have lots of historical data), but that seems not to be the case today.

Many thanks again,

Telman

Israel Kloss

unread,
May 19, 2014, 8:41:14 PM5/19/14
to google-analytics...@googlegroups.com
Nick, 
Thanks for posting this. It answers my question even if in a very disappointing way. How can I do predictive modeling without the non-CV state? I can't from past data. Now I must set up an automatic (not set) CV for every user session and overwrite it for certain instances. Very disappointing.  Is there any future goal to fix this for those of us who need pristine event tracking for predictive modeling and other purposes? 

-- Israel 

On Wednesday, March 7, 2012 3:06:21 PM UTC-5, Nick wrote:
Reply all
Reply to author
Forward
0 new messages