// Create a query using the DataQuery Object. DataQuery query = new DataQuery(new URL( "https://www.google.com/analytics/feeds/data")); query.setStartDate(today); query.setEndDate(today); query.setMetrics("ga:visitors"); query.setIds("ga:XXXXXX"); DataFeed dataFeed = analyticsService.getFeed( query.getUrl(), DataFeed.class); long visitors = 0; for (DataEntry entry : dataFeed.getEntries()) { visitors += entry.longValueOf("ga:visitors"); }