Package com.google.gdata.client.analytics

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


   * Returns a new AnalyticsService object authorized using the Client Login
   * authorization routine.
   * @return An AnalyticsService object.
   */
  public static AnalyticsService getAnalyticsService() {
    AnalyticsService analyticsService = new AnalyticsService(APP_NAME);
    try {
      analyticsService.setUserCredentials(USERNAME, PASSWORD);
    } catch (AuthenticationException e) {
      handleException(e);
    }
    return analyticsService;
  }
View Full Code Here


   * Returns a new AnalyticsService object that has been authorized with
   * Client Login authorization mechanism.
   * @return A new AnalyticsService object.
   */
  private static AnalyticsService getAnalyticsService() {
    AnalyticsService analyticsService = new AnalyticsService(APP_NAME);
    try {

      analyticsService.setUserCredentials(USERNAME, PASSWORD);

    } catch (AuthenticationException e) {
      System.err.println("Problem setting credentials: " + e.getMessage());
      System.exit(0);
    }
View Full Code Here

   * @throws ServiceException if an error occurs with the Google Analytics API.
   */
  public DataFeedExample() throws AuthenticationException, IOException, ServiceException {

    // Configure GA API.
    AnalyticsService as = new AnalyticsService("gaExportAPI_acctSample_v2.0");

    // 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

    return new GoogleDataManager(
        UserServiceFactory.getUserService(),
        new TokenDaoJdoImpl(
            PMF.getInstance()),
        new AnalyticsServiceWrapper(
            new AnalyticsService(applicationName),
            new AuthorizationServiceAuthSubImpl(
                GoogleDataManager.GOOGLE_DATA_SCOPE),
            tableId));
  }
View Full Code Here

    return new GoogleDataManager(
        UserServiceFactory.getUserService(),
        new TokenDaoJdoImpl(
            PMF.getInstance()),
        new AnalyticsServiceWrapper(
            new AnalyticsService(applicationName),
            new AuthorizationServiceOauthImpl(
                GoogleDataManager.GOOGLE_DATA_SCOPE,
                new GoogleOAuthParameters()),
            tableId));
  }
View Full Code Here

TOP

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

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.