List of usage examples for com.google.gwt.gdata.client.analytics DataFeedCallback DataFeedCallback
DataFeedCallback
From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsBounceRateDemo.java
License:Apache License
/** * Retrieves a data feed for an Analytics account using a Query object. * In GData, feed URIs can contain querystring parameters. The * GData query objects aid in building parameterized feed URIs. * Upon successfully receiving the data feed, the data entries are displayed * to the user via the showData method./*from ww w .j av a 2s. co m*/ * Query parameters are specified for start and end dates, dimensions, * metrics, sort field and direction, max results and the IDs of the * account tables which should be queried. * * @param tableId The id of the account table for which to retrieve the * Analytics data. */ private void queryData(String tableId) { DataQuery query = DataQuery.newInstance("https://www.google.com/analytics/feeds/data"); query.setStartDate("2009-07-01"); query.setEndDate("2009-07-31"); query.setDimensions("ga:source,ga:medium"); query.setMetrics("ga:entrances,ga:bounces"); query.setSort("-ga:entrances"); query.setMaxResults(10); query.setIds(tableId); showStatus("Loading data feed...", false); service.getDataFeed(query, new DataFeedCallback() { public void onFailure(CallErrorException caught) { showStatus( "An error occurred while retrieving the Analytics Data " + "feed: " + caught.getMessage(), true); } public void onSuccess(DataFeed result) { showData(result.getEntries()); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsLanguagesDemo.java
License:Apache License
/** * Retrieves a data feed for an Analytics account using a Query object. * In GData, feed URIs can contain querystring parameters. The * GData query objects aid in building parameterized feed URIs. * Upon successfully receiving the data feed, the data entries are displayed * to the user via the showData method.//from www. j a v a2s . c om * Query parameters are specified for start and end dates, dimensions, * metrics, sort field and direction, query filters and the IDs of the * account tables which should be queried. * * @param tableId The id of the account table for which to retrieve the * Analytics data. */ private void queryData(String tableId) { DataQuery query = DataQuery.newInstance("https://www.google.com/analytics/feeds/data"); query.setStartDate("2009-07-01"); query.setEndDate("2009-07-31"); query.setDimensions("ga:country,ga:language"); query.setMetrics("ga:visits"); query.setSort("ga:country,-ga:visits"); query.setMaxResults(10); query.setFilters("ga:country==United States"); query.setIds(tableId); showStatus("Loading data feed...", false); service.getDataFeed(query, new DataFeedCallback() { public void onFailure(CallErrorException caught) { showStatus( "An error occurred while retrieving the Analytics Data " + "feed: " + caught.getMessage(), true); } public void onSuccess(DataFeed result) { showData(result.getEntries()); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsTopPagesDemo.java
License:Apache License
/** * Retrieves a data feed for an Analytics account using a Query object. * In GData, feed URIs can contain querystring parameters. The * GData query objects aid in building parameterized feed URIs. * Upon successfully receiving the data feed, the data entries are displayed * to the user via the showData method.//from www . ja v a 2 s . co m * Query parameters are specified for start and end dates, dimensions, * metrics, sort field and direction, max results and the IDs of the * account tables which should be queried. * * @param tableId The id of the account table for which to retrieve the * Analytics data. */ private void queryData(String tableId) { DataQuery query = DataQuery.newInstance("https://www.google.com/analytics/feeds/data"); query.setStartDate("2009-07-01"); query.setEndDate("2009-07-31"); query.setDimensions("ga:pageTitle,ga:pagePath"); query.setMetrics("ga:pageviews"); query.setSort("-ga:pageviews"); query.setMaxResults(10); query.setIds(tableId); showStatus("Loading data feed...", false); service.getDataFeed(query, new DataFeedCallback() { public void onFailure(CallErrorException caught) { showStatus( "An error occurred while retrieving the Analytics Data " + "feed: " + caught.getMessage(), true); } public void onSuccess(DataFeed result) { showData(result.getEntries()); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsTopSearchesDemo.java
License:Apache License
/** * Retrieves a data feed for an Analytics account using a Query object. * In GData, feed URIs can contain querystring parameters. The * GData query objects aid in building parameterized feed URIs. * Upon successfully receiving the data feed, the data entries are * displayed to the user via the showData method. * Query parameters are specified for start and end dates, dimensions, * metrics, sort field and direction, max results and the IDs of the * account tables which should be queried. * //from w w w . j a v a 2s .c o m * @param tableId The id of the account table for which to retrieve the * Analytics data. */ private void queryData(String tableId) { DataQuery query = DataQuery.newInstance("https://www.google.com/analytics/feeds/data"); query.setStartDate("2009-07-01"); query.setEndDate("2009-07-31"); query.setDimensions("ga:searchKeyword,ga:searchKeywordRefinement," + "ga:searchDestinationPage"); query.setMetrics("ga:searchRefinements"); query.setSort("-ga:searchRefinements"); query.setMaxResults(10); query.setIds(tableId); showStatus("Loading data feed...", false); service.getDataFeed(query, new DataFeedCallback() { public void onFailure(CallErrorException caught) { showStatus( "An error occurred while retrieving the Analytics Data " + "feed: " + caught.getMessage(), true); } public void onSuccess(DataFeed result) { showData(result.getEntries()); } }); }
From source file:com.google.gwt.gdata.sample.hellogdata.client.AnalyticsVisitsDemo.java
License:Apache License
/** * Retrieves a data feed for an Analytics account using a Query object. * In GData, feed URIs can contain querystring parameters. The * GData query objects aid in building parameterized feed URIs. * Upon successfully receiving the data feed, the data entries are * displayed to the user via the showData method. * Query parameters are specified for start and end dates, dimensions, * metrics, sort field and direction and the IDs of the * account tables which should be queried. * // w w w . j av a 2 s . c om * @param tableId The id of the account table for which to retrieve the * Analytics data. */ private void queryData(String tableId) { DataQuery query = DataQuery.newInstance("https://www.google.com/analytics/feeds/data"); query.setStartDate("2009-07-01"); query.setEndDate("2009-07-31"); query.setDimensions("ga:date"); query.setMetrics("ga:visits,ga:pageviews"); query.setSort("ga:date"); query.setIds(tableId); showStatus("Loading data feed...", false); service.getDataFeed(query, new DataFeedCallback() { public void onFailure(CallErrorException caught) { showStatus( "An error occurred while retrieving the Analytics " + "Data feed: " + caught.getMessage(), true); } public void onSuccess(DataFeed result) { showData(result.getEntries()); } }); }