Package com.google.gdata.client.analytics

Examples of com.google.gdata.client.analytics.DataQuery


   * Returns a new DataQuery Object. You can configure this with your own
   * parameters.
   * @return A new DataQuery Object set with parameters.
   */
  public static DataQuery getDataQuery() {
    DataQuery dataQuery = null;
    try {
      dataQuery = new DataQuery(new URL(DATA_FEED_URL));
    } catch (MalformedURLException e) {
      handleException(e);
    }

    dataQuery.setIds(TABLE_ID);
    dataQuery.setStartDate("2010-03-01");
    dataQuery.setEndDate("2010-03-05");
    dataQuery.setDimensions("ga:landingPagePath,ga:date");
    dataQuery.setMetrics("ga:entrances");
    dataQuery.setSort("ga:landingPagePath,ga:date");
    dataQuery.setFilters("ga:landingPagePath=~^/Accessories/Coffee");
    return dataQuery;
  }
View Full Code Here


    resultManager.setResults(results);

    FilteredQueries queries = queryManager.getFilteredQueries(dataQuery, dimensionValues);

    while (queries.hasNext()) {
      DataQuery query = queries.next();
      DataFeed feed = dataManager.getFeed(query);
      resultManager.addRows(feed);
    }

    return results;
View Full Code Here

   * in subsequent API calls to get a metric for each dimension over time.
   * This should always have at most one dimension and one metric.
   * @return A DataQuery Object.
   */
  private static DataQuery getDataQuery() {
    DataQuery dataQuery = null;
    try {
      dataQuery = new DataQuery(new URL(BASE_DATA_FEED_URL));
    } catch (MalformedURLException e) {
      System.err.println("There was a problem: " + e.getMessage());
      System.exit(0);
    }

    dataQuery.setIds(TABLE_ID);
    dataQuery.setStartDate("2010-01-01");
    dataQuery.setEndDate("2010-03-01");
    dataQuery.setDimensions("ga:source");
    dataQuery.setMetrics("ga:visits");
    dataQuery.setSort("-ga:visits");
    dataQuery.setFilters("ga:medium==referral");
    dataQuery.setMaxResults(20);

    return dataQuery;
  }
View Full Code Here

    // Client Login Authorization.
    as.setUserCredentials(CLIENT_USERNAME, CLIENT_PASS);

    // GA Data Feed query uri.
    String baseUrl = "https://www.google.com/analytics/feeds/data";
    DataQuery query = new DataQuery(new URL(baseUrl));
    query.setIds(TABLE_ID);
    query.setDimensions("ga:source,ga:medium");
    query.setMetrics("ga:visits,ga:bounces");
    query.setSegment("gaid::-11");
    query.setFilters("ga:medium==referral");
    query.setSort("-ga:visits");
    query.setMaxResults(5);
    query.setStartDate("2008-10-01");
    query.setEndDate("2008-10-31");
    URL url = query.getUrl();
    System.out.println("URL: " + url.toString());

    // Send our request to the Analytics API and wait for the results to
    // come back.
    feed = as.getFeed(url, DataFeed.class);
View Full Code Here

    // Formatter for date.
    SimpleDateFormat gaDate = new SimpleDateFormat("yyyy-MM-dd");

    // Make a query.
    DataQuery query = new DataQuery(new URL(BASE_DATA_FEED_URL));
    query.setIds(tableId);
    query.setDimensions("ga:landingPagePath");
    query.setMetrics("ga:entrances,ga:bounces");
    query.setSort("-ga:entrances");
    query.setMaxResults(500);
    query.setStartDate(gaDate.format(twoWeeksAgo.getTime()));
    query.setEndDate(gaDate.format(yesterday.getTime()));
    return query.getUrl();
  }
View Full Code Here

TOP

Related Classes of com.google.gdata.client.analytics.DataQuery

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.