I have written the below code. But it returns articles that have most views during the time between START_DATE and END_DATE. It might contain articles that were published long before START_DATE. But I don't want articles published before START_DATE. I need articles that were published between START_DATE and END_DATE, which got most views. Is there any option Google Analytics provided?
AnalyticsService as = new AnalyticsService(appName);
String token = credential.getAccessToken();
as.setAuthSubToken(token);
DataQuery query = new DataQuery(new URL(baseUrl));
query.setIds("ga:" + propfileID);
query.setDimensions("ga:pageTitle,ga:pagePath,ga:pagePathLevel1,ga:pagePathLevel2,ga:pagePathLevel3,ga:hostname");
query.setSegment("gaid::-11");
query.setMetrics("ga:pageviews");
query.setSort("-ga:pageviews");
query.setMaxResults(20);
query.setStartDate(GA_MOST_READ_START_DATE);
query.setEndDate(GA_MOST_READ_END_DATE);
URL url = query.getUrl();
LOG.info("===GoogleAnalyticsScheduler===query==URL: " + url.toString());
DataFeed feed = as.getFeed(url, DataFeed.class);