Package com.google.api.ads.adwords.jaxws.v201309.cm

Examples of com.google.api.ads.adwords.jaxws.v201309.cm.CampaignPage


    // Get a list of all campaign IDs.
    List<Long> campaignIds = new ArrayList<Long>();
    Selector selector = new Selector();
    selector.setFields(new String[] {"Id"});
    CampaignPage campaigns = campaignService.get(selector);
    if (campaigns.getEntries() != null) {
      for (Campaign campaign : campaigns.getEntries()) {
        campaignIds.add(campaign.getId());
      }
    }

    // Create date time range for the past 24 hours.
View Full Code Here


    String oneWeekAgo = new DateTime().minusDays(7).toString("yyyyMMdd");
    String yesterday = new DateTime().minusDays(1).toString("yyyyMMdd");
    selector.setDateRange(new DateRange(oneWeekAgo, yesterday));
    selector.setPaging(new Paging(offset, PAGE_SIZE));

    CampaignPage page = null;
    do {
      // Get all campaigns.
      page = campaignService.get(selector);

      // Display campaigns.
      if (page.getEntries() != null) {
        for (Campaign campaign : page.getEntries()) {
          System.out.printf("Campaign with id \"%d\" and name \"%s\" had the following stats "
              + "during the last week.\n", campaign.getId(), campaign.getName());
          System.out.printf("  Impressions: %d\n", campaign.getCampaignStats().getImpressions());
          System.out.printf("  Clicks: %d\n", campaign.getCampaignStats().getClicks());
          System.out.printf("  Cost: %.02f\n", campaign.getCampaignStats().getCost()
              .getMicroAmount() / 1000000.0);
          System.out.printf("  CTR: %.02f %%\n", campaign.getCampaignStats().getCtr() * 100.0);
        }
      } else {
        System.out.println("No matching campaigns were found.");
      }

      offset += PAGE_SIZE;
      selector.getPaging().setStartIndex(offset);
    } while (offset < page.getTotalNumEntries());
  }
View Full Code Here

    int offset = 0;

    String query = "SELECT Id, Name, Status ORDER BY Name";


    CampaignPage page = null;
    do {
      String pageQuery = query + String.format(" LIMIT %d, %d", offset, PAGE_SIZE);
      // Get all campaigns.
      page = campaignService.query(pageQuery);

      // Display campaigns.
      if (page.getEntries() != null) {
        for (Campaign campaign : page.getEntries()) {
          System.out.println("Campaign with name \"" + campaign.getName() + "\" and id \""
              + campaign.getId() + "\" was found.");
        }
      } else {
        System.out.println("No campaigns were found.");
      }

      offset += PAGE_SIZE;
    } while (offset < page.getTotalNumEntries());
  }
View Full Code Here

    Selector selector = new Selector();
    selector.setFields(new String[] {"Id", "Name"});
    selector.setOrdering(new OrderBy[] {new OrderBy("Name", SortOrder.ASCENDING)});
    selector.setPaging(new Paging(offset, PAGE_SIZE));

    CampaignPage page = null;
    do {
      // Get all campaigns.
      page = campaignService.get(selector);

      // Display campaigns.
      if (page.getEntries() != null) {
        for (Campaign campaign : page.getEntries()) {
          System.out.println("Campaign with name \"" + campaign.getName() + "\" and id \""
              + campaign.getId() + "\" was found.");
        }
      } else {
        System.out.println("No campaigns were found.");
      }

      offset += PAGE_SIZE;
      selector.getPaging().setStartIndex(offset);
    } while (offset < page.getTotalNumEntries());
  }
View Full Code Here

    // Get a list of all campaign IDs.
    List<Long> campaignIds = new ArrayList<Long>();
    Selector selector = new Selector();
    selector.setFields(new String[] {"Id"});
    CampaignPage campaigns = campaignService.get(selector);
    if (campaigns.getEntries() != null) {
      for (Campaign campaign : campaigns.getEntries()) {
        campaignIds.add(campaign.getId());
      }
    }

    // Create date time range for the past 24 hours.
View Full Code Here

    int offset = 0;

    String query = "SELECT Id, Name, Status ORDER BY Name";


    CampaignPage page = null;
    do {
      String pageQuery = query + String.format(" LIMIT %d, %d", offset, PAGE_SIZE);
      // Get all campaigns.
      page = campaignService.query(pageQuery);

      // Display campaigns.
      if (page.getEntries() != null) {
        for (Campaign campaign : page.getEntries()) {
          System.out.println("Campaign with name \"" + campaign.getName() + "\" and id \""
              + campaign.getId() + "\" was found.");
        }
      } else {
        System.out.println("No campaigns were found.");
      }

      offset += PAGE_SIZE;
    } while (offset < page.getTotalNumEntries());
  }
View Full Code Here

    // Create selector.
    Selector selector = new Selector();
    selector.setFields(new String[] {"Id", "Name"});

    // Get all campaigns.
    CampaignPage page = campaignService.get(selector);

    // Display campaigns.
    if (page.getEntries() != null) {
      for (Campaign campaign : page.getEntries()) {
        System.out.println("Campaign with name \"" + campaign.getName() + "\" and id \""
            + campaign.getId() + "\" was found.");
      }
    } else {
      System.out.println("No campaigns were found.");
View Full Code Here

    Selector selector = new Selector();
    selector.setFields(new String[] {"Id", "Name"});
    selector.setOrdering(new OrderBy[] {new OrderBy("Name", SortOrder.ASCENDING)});
    selector.setPaging(new Paging(offset, PAGE_SIZE));

    CampaignPage page = null;
    do {
      // Get all campaigns.
      page = campaignService.get(selector);

      // Display campaigns.
      if (page.getEntries() != null) {
        for (Campaign campaign : page.getEntries()) {
          System.out.println("Campaign with name \"" + campaign.getName() + "\" and id \""
              + campaign.getId() + "\" was found.");
        }
      } else {
        System.out.println("No campaigns were found.");
      }

      offset += PAGE_SIZE;
      selector.getPaging().setStartIndex(offset);
    } while (offset < page.getTotalNumEntries());
  }
View Full Code Here

    // Get a list of all campaign IDs.
    List<Long> campaignIds = new ArrayList<Long>();
    Selector selector = new SelectorBuilder()
        .fields("Id")
        .build();
    CampaignPage campaigns = campaignService.get(selector);
    if (campaigns.getEntries() != null) {
      for (Campaign campaign : campaigns.getEntries()) {
        campaignIds.add(campaign.getId());
      }
    }

    // Create date time range for the past 24 hours.
View Full Code Here

        .orderAscBy("Name")
        .offset(offset)
        .limit(PAGE_SIZE)
        .build();

    CampaignPage page = null;
    do {
      // Get all campaigns.
      page = campaignService.get(selector);

      // Display campaigns.
      if (page.getEntries() != null) {
        for (Campaign campaign : page.getEntries()) {
          System.out.println("Campaign with name \"" + campaign.getName() + "\" and id \""
              + campaign.getId() + "\" was found.");
        }
      } else {
        System.out.println("No campaigns were found.");
      }

      offset += PAGE_SIZE;
      selector = builder.increaseOffsetBy(PAGE_SIZE).build();
    } while (offset < page.getTotalNumEntries());
  }
View Full Code Here

TOP

Related Classes of com.google.api.ads.adwords.jaxws.v201309.cm.CampaignPage

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.