1
votes

I have these two queries (only the segments differ)

/analytics/feeds/data?ids=ga:...&dimensions=ga:date&metrics=ga:visits&segment=gaid%3A%3A-1&start-date=2011-05-16&end-date=2011-06-14&max-results=1000

/analytics/feeds/data?ids=ga:...&dimensions=ga:date&metrics=ga:visits&segment=gaid%3A%3A-4&start-date=2011-05-16&end-date=2011-06-14&max-results=1000

where the second should return different (smaller) results than the first. But both deliver the same results. What am I doing wrong?

1

1 Answers

2
votes

Advanced segments have only been added in v2 of the Google Analytics API. This version is apparently not used by default. You need to explicitly request the second version by either adding the GData-Version: 2 header or by including v=2 as a parameter of the query.

See the Google Analytics API Docs for more information.