Reputation: 461
ga:daysSinceLastSession >= 20
says. 400 : Invalid value 'ga:daysSinceLastSession >= 20' for filters parameter.
But according to the manual that's way you should do it. So what am I doing wrong here?
https://www.googleapis.com/analytics/v3/data/ga?ids=REMOVED&dimensions=ga%3AdaysSinceLastSession&metrics=ga%3Ausers&segment=gaid%3A%3A-14&filters=ga%3AdaysSinceLastSession%20%3E%3D%2020&start-date=2014-05-12&end-date=2014-05-14&max-results=50
Upvotes: 2
Views: 1461
Reputation: 116918
ga:daysSinceLastSession is a dimension. Dimensons can only be filtered on
Answer: 'ga:daysSinceLastSession >= 20'
is an invalid use of a filter because you cant do >= on a dimension.
Link to filters with the Core reporting api: Filteres
Edit:
The only option I can think of would be a very scary filter something like ga:daysSinceLastSession==10,ga:daysSinceLastSession==11,ga:daysSinceLastSession==12
Note: I'm not sure how long a filter can be documentation says 128 characters for regular expression filters but I'm not sure if that limit will apply here. But the max length of a URL is 2000 characters so you will have to test the max length of your request string as you build it.
Upvotes: 3
Reputation: 32760
Data Type for daysSinceLastSession is String, so I guess a mathematical operator won't work (equality operator works fine in the query explorer). I think you'd have to go for an regular expression (at least two numbers, first numbers 2 or larger).
Upvotes: 0