r - Google Analytics query for sessions -
i trying analyze visits purchase in google analytics through r.
here code
query.list<-init(start.date = "2016-07-01", end.date = "2016-08-01", dimensions = c("ga:daystotransaction","ga:sessionstotransaction"), metrics = c("ga:transaction"), sort = c("ga:date"), table.id = "ga:104454195")
i have code shows error error in parsedatafeedjson(ga.data) : code : 400 reason : sort key ga:date not dimension or metric in query.
can me desired output
days transaction transaction %total
0 44 50%
1 11 20%
2-5 22 30%
you trying sort results based on dimension, not included in result set. have ga:daystotransaction
, ga:sessionstotransactions
dimensions, , have tried apply sort based on ga:date
.
you'll need use sorting:
sort = c("ga:daystotransaction")
it not clear me, if you'll use ga:sessionstotransactions in other part of script, it'll add other breakdown compared desired output, needs aggregated later expected results.
also, calculate %total in other part of script, or expect returned part of analytics response? (about i'm not sure, if it's possible in ga api or not.)
Comments
Post a Comment