Reputation: 323
Hey guys so I have tried many different ways to do this query
query.list <- Init(start.date = "2016-09-19",
end.date = "2016-09-23",
dimensions = "ga:date,ga:hour,ga:minute,ga:country",
metrics = "ga:newUsers",
filters = "ga:source!=Emai, ga:country==United Kingdom",
max.results = 10000,
sort = "ga:date",
table.id = "ga:XXXX"
)
ga.query <- QueryBuilder(query.list)
ga.data2 <- data.table(GetReportData(ga.query, token, split_daywise = T )
)
I do not know why it doesn't filter the country. I have tried only filtering the country and it simply does not work, I'm sure is something real simple that I'm missing. But I have tried every recommendation in other questions and is still not working. If I take out the country filter it works and if I put it does not do anything.. just outputs the same data
Upvotes: 0
Views: 200
Reputation: 15923
Since you need to include AND
operator, which is denoted by a semicolon ;
. Moreover, you need to URL encode all the parameters in the filter, so the correct filter would be:
ga:source!=Email;ga:country%3D%3DUnited%20Kingdom
To all readers:
While building the query in R for core reporting, please make sure that all the values are URL encoded
. If you feel any difficulty in encoding, you can build the query from Google's Query Explorer
Upvotes: 1