Can I compare 2 dimensions in a Google Analytics query filter?

I am just starting with the Google Analytics API and wondering if it is possible to compare two dimensions through the operand in the filters that I pass in the request. And, being surprised, I mean that I tried this, but did not succeed.

In particular, I am trying to compare 2 values โ€‹โ€‹of user variables. One of them contains the user who created the message (customVarValue3), and the other contains the user who views the message (customVarValue5). I want to get pageviews only for visitors who are also not creators. The filter looks like this (without using urlencoding):

ga:customVarValue3!=ga:customVarValue5 

The full request (encoded url) is as follows:

 https://www.google.com/analytics/feeds/data?ids=ga%3Axxxxxx&dimensions=ga%3AcustomVarValue1%2Cga%3AcustomVarValue2%2Cga%3AcustomVarValue3&metrics=ga%3Apageviews&filters=ga%3AcustomVarValue3!%3Dga%3AcustomVarValue5&sort=-ga%3Apageviews&start-date=2012-02-09&end-date=2012-02-23&max-results=50 

However, it returns the same results (and I know there are results where ga: customVarValue3 == ga: customVarValue5).

This is probably not possible, but I just wanted to find out if anyone knows how to do this or is there a workaround or something like that.

+4
source share
1 answer

No, using the GAv3 API in its current state is not possible. However, you can get all the results using the specified two user variables as dimensions for the report and programmatically filter out unnecessary results.

Some simple construction like

 for(var item in collatedResultsListwithDimensions) { for(var row in item.rows) { if(row[0]!=row[1]) newResultRows.push(row); } } 

Now your newResultRows will have those rows where row[1]!=row[0] , assuming that the two user variables you mentioned are the first two dimensions.

+1
source

Source: https://habr.com/ru/post/1398168/


All Articles