works in javascript but not in java?

1 view
Skip to first unread message

Angelo Chen

unread,
Nov 6, 2009, 5:10:29 AM11/6/09
to google-analytics-api - GA Data Export API
Hi,

I use the Google Analytics Interactive tool and following returns
result:

var feedUri = 'https://www.google.com/analytics/feeds/data' +
'?start-date=2009-10-06' +
'&end-date=2009-11-07' +
'&dimensions=ga:date' +
'&metrics=ga:visits' +
'&filters=ga:pagePath%3D@/12345/' +
'&sort=ga:date' +
'&ids=' + document.getElementById('tableid').value;

I use java client lib, following returns zero on visits, any idea why?
Thanks

DataQuery query = new DataQuery(new URL(
"https://www.google.com/analytics/feeds/data"));
query.setStartDate("2009-10-06");
query.setEndDate("2009-11-07");
query.setDimensions("ga:date");
query.setMetrics("ga:visits");
query.setFilters("ga:pagepath==/12345/");
query.setSort("ga:date");
query.setMaxResults(50);
query.setIds(TABLE_ID);

Nick

unread,
Nov 10, 2009, 10:04:41 PM11/10/09
to google-analytics-api - GA Data Export API
Hi,

You are using different operators in your filters.

=@ is Contains substring
== is Exact match

Details here: http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDataFeed.html#filters

-Nick
Reply all
Reply to author
Forward
0 new messages