Package com.google.api.ads.dfp.v201311

Examples of com.google.api.ads.dfp.v201311.ReportServiceInterface


    // Get DfpUser from "~/dfp.properties".
    DfpUser user = new DfpUser();

    // Get the ReportService.
    ReportServiceInterface reportService = user.getService(DfpService.V201308.REPORT_SERVICE);

    // Create report job.
    ReportJob reportJob = new ReportJob();

    // Create report query.
    ReportQuery reportQuery = new ReportQuery();
    reportQuery.setDateRangeType(DateRangeType.CUSTOM_DATE);
    reportQuery.setStartDate(DateUtils.fromString("2011-03-01"));
    reportQuery.setEndDate(DateUtils.today("PST"));
    reportQuery.setDimensions(new Dimension[] {
        Dimension.ORDER_ID, Dimension.ORDER_NAME, Dimension.LINE_ITEM_ID,
        Dimension.LINE_ITEM_NAME});
    reportQuery.setColumns(new Column[] {Column.AD_SERVER_IMPRESSIONS,
        Column.AD_SERVER_CLICKS, Column.AD_SERVER_CTR,
        Column.AD_SERVER_CPM_AND_CPC_REVENUE, Column.AD_SERVER_WITHOUT_CPD_AVERAGE_ECPM});
    reportJob.setReportQuery(reportQuery);

    System.out.println("Running report job.");

    // Run report job.
    long reportJobId = reportService.runReportJob(reportJob).getId();

    final ReportUtils reportUtils = new ReportUtils(reportService, reportJobId);

    // Change to your file location.
    final String gzCsvPath = "/path/to/filename.csv.gz";
View Full Code Here


    // Get DfpUser from "~/dfp.properties".
    DfpUser user = new DfpUser();

    // Get the ReportService.
    ReportServiceInterface reportService = user.getService(DfpService.V201308.REPORT_SERVICE);

    // Create report job.
    ReportJob reportJob = new ReportJob();

    // Create report query.
    ReportQuery reportQuery = new ReportQuery();
    reportQuery.setDateRangeType(DateRangeType.CUSTOM_DATE);
    reportQuery.setStartDate(DateUtils.fromString("2011-03-01"));
    reportQuery.setEndDate(DateUtils.today("PST"));
    reportQuery.setDimensions(new Dimension[] {
        Dimension.ORDER_ID, Dimension.ORDER_NAME, Dimension.LINE_ITEM_ID,
        Dimension.LINE_ITEM_NAME});
    reportQuery.setColumns(new Column[] {Column.AD_SERVER_IMPRESSIONS,
        Column.AD_SERVER_CLICKS, Column.AD_SERVER_CTR,
        Column.AD_SERVER_CPM_AND_CPC_REVENUE, Column.AD_SERVER_WITHOUT_CPD_AVERAGE_ECPM});
    reportJob.setReportQuery(reportQuery);

    System.out.println("Running report job.");

    // Run report job.
    long reportJobId = reportService.runReportJob(reportJob).getId();

    final ReportUtils reportUtils = new ReportUtils(reportService, reportJobId);

    // Change to use synchronous or asynchronous downloading.
    boolean useSynchronous = true;
View Full Code Here

        offset += 500;
      } while (offset < page.getTotalResultSetSize());

      // Get the ReportService.
      ReportServiceInterface reportService = user.getService(DfpService.V201308.REPORT_SERVICE);

      // Create statement to filter for an order.
      filterStatement =
          new StatementBuilder("WHERE ORDER_ID = :orderId").putValue("orderId", orderId)
              .toStatement();

      // Create report job.
      ReportJob reportJob = new ReportJob();

      // Create report query.
      ReportQuery reportQuery = new ReportQuery();
      reportQuery.setDateRangeType(DateRangeType.LAST_MONTH);
      reportQuery.setDimensions(new Dimension[] {Dimension.LINE_ITEM_ID, Dimension.LINE_ITEM_NAME});
      reportQuery.setStatement(filterStatement);
      reportQuery.setCustomFieldIds(ArrayUtils.toPrimitive(customFieldIds.toArray(new Long[]{})));
      reportQuery.setColumns(new Column[] {Column.AD_SERVER_IMPRESSIONS});
      reportJob.setReportQuery(reportQuery);

      // Run report job.
      reportJob = reportService.runReportJob(reportJob);

      do {
        System.out.println("Report with ID '" + reportJob.getId() + "' is still running.");
        Thread.sleep(30000);
        // Get report job.
        reportJob = reportService.getReportJob(reportJob.getId());
      } while (reportJob.getReportJobStatus() == ReportJobStatus.IN_PROGRESS);

      if (reportJob.getReportJobStatus() == ReportJobStatus.FAILED) {
        System.out.println("Report job with ID '" + reportJob.getId()
            + "' failed to finish successfully.");
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the ReportService.
      ReportServiceInterface reportService = user.getService(DfpService.V201308.REPORT_SERVICE);

      // Create report job.
      ReportJob reportJob = new ReportJob();

      // Create report query.
      ReportQuery reportQuery = new ReportQuery();
      reportQuery.setDateRangeType(DateRangeType.LAST_MONTH);
      reportQuery.setDimensions(
          new Dimension[] {Dimension.SALESPERSON_ID, Dimension.SALESPERSON_NAME});
      reportQuery.setColumns(new Column[] {Column.AD_SERVER_IMPRESSIONS,
          Column.AD_SERVER_CPM_AND_CPC_REVENUE, Column.AD_SERVER_WITHOUT_CPD_AVERAGE_ECPM});
      reportJob.setReportQuery(reportQuery);

      // Run report job.
      reportJob = reportService.runReportJob(reportJob);

      do {
        System.out.println("Report with ID '" + reportJob.getId() + "' is still running.");
        Thread.sleep(30000);
        // Get report job.
        reportJob = reportService.getReportJob(reportJob.getId());
      } while (reportJob.getReportJobStatus() == ReportJobStatus.IN_PROGRESS);

      if (reportJob.getReportJobStatus() == ReportJobStatus.FAILED) {
        System.out.println("Report job with ID '" + reportJob.getId()
            + "' failed to finish successfully.");
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the ReportService.
      ReportServiceInterface reportService = user.getService(DfpService.V201308.REPORT_SERVICE);

      // Create report job.
      ReportJob reportJob = new ReportJob();

      // Create report query.
      ReportQuery reportQuery = new ReportQuery();
      reportQuery.setDateRangeType(DateRangeType.REACH_LIFETIME);
      reportQuery.setDimensions(new Dimension[] {Dimension.LINE_ITEM_ID, Dimension.LINE_ITEM_NAME});
      reportQuery.setColumns(new Column[] {Column.REACH_FREQUENCY,
          Column.REACH_AVERAGE_REVENUE, Column.REACH});
      reportJob.setReportQuery(reportQuery);

      // Run report job.
      reportJob = reportService.runReportJob(reportJob);

      do {
        System.out.println("Report with ID '" + reportJob.getId() + "' is still running.");
        Thread.sleep(30000);
        // Get report job.
        reportJob = reportService.getReportJob(reportJob.getId());
      } while (reportJob.getReportJobStatus() == ReportJobStatus.IN_PROGRESS);

      if (reportJob.getReportJobStatus() == ReportJobStatus.FAILED) {
        System.out.println("Report job with ID '" + reportJob.getId()
            + "' failed to finish successfully.");
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the ReportService.
      ReportServiceInterface reportService = user.getService(DfpService.V201308.REPORT_SERVICE);

      // Create report job.
      ReportJob reportJob = new ReportJob();

      // Create report query.
      ReportQuery reportQuery = new ReportQuery();
      reportQuery.setDateRangeType(DateRangeType.LAST_WEEK);
      reportQuery.setDimensions(new Dimension[] {Dimension.DATE, Dimension.AD_UNIT_NAME});     
      reportQuery.setColumns(new Column[] {Column.AD_SERVER_IMPRESSIONS,
          Column.AD_SERVER_CLICKS, Column.DYNAMIC_ALLOCATION_INVENTORY_LEVEL_IMPRESSIONS,
          Column.DYNAMIC_ALLOCATION_INVENTORY_LEVEL_CLICKS,
          Column.TOTAL_INVENTORY_LEVEL_IMPRESSIONS,
          Column.TOTAL_INVENTORY_LEVEL_CPM_AND_CPC_REVENUE});
      reportQuery.setAdUnitView(ReportQueryAdUnitView.HIERARCHICAL);
      reportJob.setReportQuery(reportQuery);

      // Run report job.
      reportJob = reportService.runReportJob(reportJob);

      do {
        System.out.println("Report with ID '" + reportJob.getId() + "' is still running.");
        Thread.sleep(30000);
        // Get report job.
        reportJob = reportService.getReportJob(reportJob.getId());
      } while (reportJob.getReportJobStatus() == ReportJobStatus.IN_PROGRESS);

      if (reportJob.getReportJobStatus() == ReportJobStatus.FAILED) {
        System.out.println("Report job with ID '" + reportJob.getId()
            + "' failed to finish successfully.");
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the ReportService.
      ReportServiceInterface reportService = user.getService(DfpService.V201308.REPORT_SERVICE);

      Long orderId = Long.parseLong("INSERT_ORDER_ID_HERE");

      // Create statement to filter for an order.
      Statement filterStatement =
          new StatementBuilder("WHERE ORDER_ID = :id").putValue("id", orderId).toStatement();

      // Create report job.
      ReportJob reportJob = new ReportJob();

      // Create report query.
      ReportQuery reportQuery = new ReportQuery();
      reportQuery.setDateRangeType(DateRangeType.LAST_MONTH);
      reportQuery.setDimensions(new Dimension[] {Dimension.ORDER_ID, Dimension.ORDER_NAME});
      reportQuery.setDimensionAttributes(new DimensionAttribute[] {
          DimensionAttribute.ORDER_TRAFFICKER, DimensionAttribute.ORDER_START_DATE_TIME,
          DimensionAttribute.ORDER_END_DATE_TIME});
      reportQuery.setStatement(filterStatement);
      reportQuery.setColumns(new Column[] {Column.AD_SERVER_IMPRESSIONS,
          Column.AD_SERVER_CLICKS, Column.AD_SERVER_CTR,
          Column.AD_SERVER_CPM_AND_CPC_REVENUE, Column.AD_SERVER_WITHOUT_CPD_AVERAGE_ECPM});
      reportJob.setReportQuery(reportQuery);

      // Run report job.
      reportJob = reportService.runReportJob(reportJob);

      do {
        System.out.println("Report with ID '" + reportJob.getId() + "' is still running.");
        Thread.sleep(30000);
        // Get report job.
        reportJob = reportService.getReportJob(reportJob.getId());
      } while (reportJob.getReportJobStatus() == ReportJobStatus.IN_PROGRESS);

      if (reportJob.getReportJobStatus() == ReportJobStatus.FAILED) {
        System.out.println("Report job with ID '" + reportJob.getId()
            + "' failed to finish successfully.");
View Full Code Here

      // Set the ID of the company to get.
      Long companyId = Long.parseLong("INSERT_COMPANY_ID_HERE");

      // Get the company.
      Company company = companyService.getCompany(companyId);

      if (company != null) {
        System.out.println("Company with ID \"" + company.getId()
            + "\", name \"" + company.getName()
            + "\", and type \"" + company.getType() + "\" was found.");
      } else {
        System.out.println("No company found for this ID.");
      }
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

      // Get the CompanyService.
      CompanyServiceInterface companyService =
          user.getService(DfpService.V201311.COMPANY_SERVICE);

      // Set defaults for page and filterStatement.
      CompanyPage page = new CompanyPage();
      Statement filterStatement = new Statement();
      int offset = 0;

      do {
        // Create a statement to get all companies.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

        // Get companies by statement.
        page = companyService.getCompaniesByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Company company : page.getResults()) {
            System.out.println(i + ") Company with ID \"" + company.getId()
                + "\", name \"" + company.getName()
                + "\", and type \"" + company.getType() + "\" was found.");
            i++;
          }
        }

        offset += 500;
      } while (offset < page.getTotalResultSetSize());

      System.out.println("Number of results found: " + page.getTotalResultSetSize());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the CompanyService.
      CompanyServiceInterface companyService =
          user.getService(DfpService.V201311.COMPANY_SERVICE);

      // Set defaults for page and filterStatement.
      CompanyPage page = new CompanyPage();
      Statement filterStatement = new Statement();
      int offset = 0;

      do {
        // Create a statement to get all companies.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

        // Get companies by statement.
        page = companyService.getCompaniesByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Company company : page.getResults()) {
            System.out.println(i + ") Company with ID \"" + company.getId()
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201311.ReportServiceInterface

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.