Example usage for com.google.gwt.gdata.client.analytics DataQuery setFilters

List of usage examples for com.google.gwt.gdata.client.analytics DataQuery setFilters

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.analytics DataQuery setFilters.

Prototype

public final native void setFilters(String filters) ;

Source Link

Document

Sets the dimension value filters.

Usage

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./*w  w  w  . ja  v  a2s  .c o  m*/
 * 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());
        }
    });
}