Examples of AdGroupServiceInterface


Examples of com.google.api.ads.adwords.axis.v201406.cm.AdGroupServiceInterface

  }

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session, long campaignId) throws Exception {
    // Get the AdGroupService.
    AdGroupServiceInterface adGroupService =
        adWordsServices.get(session, AdGroupServiceInterface.class);

    // Create ad group.
    AdGroup adGroup = new AdGroup();
    adGroup.setName("Earth to Mars Cruises #" + System.currentTimeMillis());
    adGroup.setStatus(AdGroupStatus.ENABLED);
    adGroup.setCampaignId(campaignId);

    // Optional settings.

    // Targeting restriction settings - these settings only affect serving
    // for the Display Network.
    TargetingSetting targeting = new TargetingSetting();
    TargetingSettingDetail placements = new TargetingSettingDetail();
    placements.setCriterionTypeGroup(CriterionTypeGroup.PLACEMENT);
    placements.setTargetAll(Boolean.TRUE);
    TargetingSettingDetail verticals = new TargetingSettingDetail();
    verticals.setCriterionTypeGroup(CriterionTypeGroup.VERTICAL);
    verticals.setTargetAll(Boolean.FALSE);
    targeting.setDetails(new TargetingSettingDetail[]{placements, verticals});

    // Create ad group bid.
    BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();
    CpcBid bid = new CpcBid();
    bid.setBid(new Money(null, 10000000L));
    biddingStrategyConfiguration.setBids(new Bids[] {bid});
    adGroup.setBiddingStrategyConfiguration(biddingStrategyConfiguration);

    // Add as many additional ad groups as you need.
    AdGroup adGroup2 = new AdGroup();
    adGroup2.setName("Earth to Venus Cruises #" + System.currentTimeMillis());
    adGroup2.setStatus(AdGroupStatus.ENABLED);
    adGroup2.setCampaignId(campaignId);

    BiddingStrategyConfiguration biddingStrategyConfiguration2 = new BiddingStrategyConfiguration();
    CpcBid bid2 = new CpcBid();
    bid2.setBid(new Money(null, 10000000L));
    biddingStrategyConfiguration2.setBids(new Bids[] {bid2});
    adGroup2.setBiddingStrategyConfiguration(biddingStrategyConfiguration2);

    // Create operations.
    AdGroupOperation operation = new AdGroupOperation();
    operation.setOperand(adGroup);
    operation.setOperator(Operator.ADD);
    AdGroupOperation operation2 = new AdGroupOperation();
    operation2.setOperand(adGroup2);
    operation2.setOperator(Operator.ADD);

    AdGroupOperation[] operations = new AdGroupOperation[] {operation, operation2};

    // Add ad groups.
    AdGroupReturnValue result = adGroupService.mutate(operations);

    // Display new ad groups.
    for (AdGroup adGroupResult : result.getValue()) {
      System.out.println("Ad group with name \"" + adGroupResult.getName() + "\" and id \""
          + adGroupResult.getId() + "\" was added.");
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201406.cm.AdGroupServiceInterface

  }

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session, long adGroupId) throws Exception {
    // Get the AdGroupService.
    AdGroupServiceInterface adGroupService =
        adWordsServices.get(session, AdGroupServiceInterface.class);

    // Create ad group with REMOVED status.
    AdGroup adGroup = new AdGroup();
    adGroup.setId(adGroupId);
    adGroup.setStatus(AdGroupStatus.REMOVED);

    // Create operations.
    AdGroupOperation operation = new AdGroupOperation();
    operation.setOperand(adGroup);
    operation.setOperator(Operator.SET);

    AdGroupOperation[] operations = new AdGroupOperation[] {operation};

    // Remove ad group.
    AdGroupReturnValue result = adGroupService.mutate(operations);

    // Display ad groups.
    for (AdGroup adGroupResult : result.getValue()) {
      System.out.println("Ad group with name \"" + adGroupResult.getName() + "\" and id \""
          + adGroupResult.getId() + "\" was removed.");
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201406.cm.AdGroupServiceInterface

  }

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session, Long adGroupId) throws Exception {
    // Get the AdGroupService.
    AdGroupServiceInterface adGroupService =
        adWordsServices.get(session, AdGroupServiceInterface.class);

    // Create ad group with updated status.
    AdGroup adGroup = new AdGroup();
    adGroup.setId(adGroupId);
    adGroup.setStatus(AdGroupStatus.PAUSED);

    // Create operations.
    AdGroupOperation operation = new AdGroupOperation();
    operation.setOperand(adGroup);
    operation.setOperator(Operator.SET);

    AdGroupOperation[] operations = new AdGroupOperation[] {operation};

    // Update ad group.
    AdGroupReturnValue result = adGroupService.mutate(operations);

    // Display ad groups.
    for (AdGroup adGroupResult : result.getValue()) {
      System.out.println("Ad group with name \"" + adGroupResult.getName() + "\", id \""
          + adGroupResult.getId() + "\", and status \"" + adGroupResult.getStatus()
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201406.cm.AdGroupServiceInterface

    System.out.printf("Campaign with name '%s' and ID %d was added.%n", campaign.getName(),
        campaign.getId());

    // Get the AdGroupService.
    AdGroupServiceInterface adGroupService =
        adWordsServices.get(session, AdGroupServiceInterface.class);

    // Create ad group.
    AdGroup adGroup = new AdGroup();
    adGroup.setCampaignId(campaign.getId());
    adGroup.setName("Ad Group #" + System.currentTimeMillis());

    // Create operation.
    AdGroupOperation adGroupOperation = new AdGroupOperation();
    adGroupOperation.setOperand(adGroup);
    adGroupOperation.setOperator(Operator.ADD);

    // Make the mutate request.
    AdGroupReturnValue adGroupAddResult =
        adGroupService.mutate(new AdGroupOperation[] {adGroupOperation});

    // Display result.
    adGroup = adGroupAddResult.getValue(0);
    System.out.printf("Ad group with name '%s' and ID %d was added.%n", adGroup.getName(),
        adGroup.getId());
View Full Code Here

Examples of com.google.api.adwords.v200909.cm.AdGroupServiceInterface

            AdWordsUser testUser = new AdWordsUser("test_data/test.properties");
            ServiceAccountantManager.getInstance().setAutoCreateAccountant(true);

            CampaignServiceInterface campaignService =
                testUser.getService(AdWordsService.V200909.CAMPAIGN_SERVICE);
            AdGroupServiceInterface adGroupService =
                testUser.getService(AdWordsService.V200909.ADGROUP_SERVICE);

            campaignService.get(new CampaignSelector());
            adGroupService.get(new AdGroupSelector());

            ServiceAccountant campaignServiceAccountant =
                ServiceAccountantManager.getInstance().getServiceAccountant(campaignService);

            ServiceAccountant adGroupServiceAccountant =
View Full Code Here

Examples of com.google.api.adwords.v200909.cm.AdGroupServiceInterface

  private void performOperations() throws Exception {
    AdWordsUser testUser = new AdWordsUser("test_data/test.properties");

    CampaignServiceInterface campaignService =
        testUser.getService(AdWordsService.V200909.CAMPAIGN_SERVICE);
    AdGroupServiceInterface adGroupService =
        testUser.getService(AdWordsService.V200909.ADGROUP_SERVICE);

    campaignService.get(new CampaignSelector());
    adGroupService.get(new AdGroupSelector());
  }
View Full Code Here

Examples of com.google.api.adwords.v201008.cm.AdGroupServiceInterface

   * @param campaignId the id of the parent campaign
   * @return the ID of the created ad group
   */
  public long createAdGroup(long campaignId) throws Exception {
    // Get the AdGroupService.
    AdGroupServiceInterface adGroupService;
    adGroupService = user.getService(AdWordsService.V201008.ADGROUP_SERVICE);

    // Create ad group.
    AdGroup adGroup = new AdGroup();
    adGroup.setName("Earth to Mars Cruises #" + System.currentTimeMillis());
    adGroup.setStatus(AdGroupStatus.ENABLED);
    adGroup.setCampaignId(campaignId);

    // Create ad group bid.
    ManualCPCAdGroupBids adGroupBids = new ManualCPCAdGroupBids();
    adGroupBids.setKeywordMaxCpc(new Bid(new Money(null, 10000000L)));
    adGroup.setBids(adGroupBids);

    // Create operations.
    AdGroupOperation operation = new AdGroupOperation();
    operation.setOperand(adGroup);
    operation.setOperator(Operator.ADD);

    AdGroupOperation[] operations = new AdGroupOperation[] {operation};

    // Add ad group and return AdGroup ID.
    return adGroupService.mutate(operations).getValue()[0].getId();
  }
View Full Code Here

Examples of com.google.api.adwords.v201306.cm.AdGroupServiceInterface

      // Get AdWordsUser from "~/adwords.properties".
      AdWordsUser user = new AdWordsUser();

      // Get the AdGroupService.
      AdGroupServiceInterface adGroupService =
          user.getService(AdWordsService.V201306.ADGROUP_SERVICE);

      long adGroupId = Long.parseLong("INSERT_AD_GROUP_ID_HERE");

      // Create ad group with DELETED status.
      AdGroup adGroup = new AdGroup();
      adGroup.setId(adGroupId);
      adGroup.setStatus(AdGroupStatus.DELETED);

      // Create operations.
      AdGroupOperation operation = new AdGroupOperation();
      operation.setOperand(adGroup);
      operation.setOperator(Operator.SET);

      AdGroupOperation[] operations = new AdGroupOperation[]{operation};

      // Delete ad group.
      AdGroupReturnValue result = adGroupService.mutate(operations);

      // Display ad groups.
      if (result != null && result.getValue() != null) {
        for (AdGroup adGroupResult : result.getValue()) {
          System.out.println("Ad group with name \"" + adGroupResult.getName() + "\" and id \""
View Full Code Here

Examples of com.google.api.adwords.v201306.cm.AdGroupServiceInterface

      // Get AdWordsUser from "~/adwords.properties".
      AdWordsUser user = new AdWordsUser();

      // Get the AdGroupService.
      AdGroupServiceInterface adGroupService =
          user.getService(AdWordsService.V201306.ADGROUP_SERVICE);

      long adGroupId = Long.parseLong("INSERT_AD_GROUP_ID_HERE");

      // Create ad group with updated status.
      AdGroup adGroup = new AdGroup();
      adGroup.setId(adGroupId);
      adGroup.setStatus(AdGroupStatus.PAUSED);

      // Create operations.
      AdGroupOperation operation = new AdGroupOperation();
      operation.setOperand(adGroup);
      operation.setOperator(Operator.SET);

      AdGroupOperation[] operations = new AdGroupOperation[]{operation};

      // Update ad group.
      AdGroupReturnValue result = adGroupService.mutate(operations);

      // Display ad groups.
      if (result != null && result.getValue() != null) {
        for (AdGroup adGroupResult : result.getValue()) {
          System.out.println("Ad group with name \"" + adGroupResult.getName() + "\", id \""
View Full Code Here

Examples of com.google.api.adwords.v201306.cm.AdGroupServiceInterface

      // Get the ExperimentService.
      ExperimentServiceInterface experimentService =
          user.getService(AdWordsService.V201306.EXPERIMENT_SERVICE);

      // Get the AdGroupService.
      AdGroupServiceInterface adGroupService =
          user.getService(AdWordsService.V201306.ADGROUP_SERVICE);

      // Get the AdGroupCriterionService.
      AdGroupCriterionServiceInterface adGroupCriterionService =
          user.getService(AdWordsService.V201306.ADGROUP_CRITERION_SERVICE);

      // Replace with valid values of your account.
      long campaignId = Long.parseLong("INSERT_CAMPAIGN_ID_HERE");
      long adGroupId = Long.parseLong("INSERT_AD_GROUP_ID_HERE");
      long criterionId = Long.parseLong("INSERT_CRITERION_ID_HERE");

      // Create experiment.
      Experiment experiment = new Experiment();
      experiment.setCampaignId(campaignId);
      experiment.setName("Interplanetary Experiment #" + System.currentTimeMillis());
      experiment.setQueryPercentage(10);
      experiment.setStartDateTime(new SimpleDateFormat("yyyyMMdd HHmmss Z").format(new Date()));

      // Create operation.
      ExperimentOperation experimentOperation = new ExperimentOperation();
      experimentOperation.setOperand(experiment);
      experimentOperation.setOperator(Operator.ADD);

      // Add experiment.
      ExperimentReturnValue result =
          experimentService.mutate(new ExperimentOperation[]{experimentOperation});

      if (result.getValue() != null) {
        for(Experiment experimentResult : result.getValue()) {
          System.out.println("Experiment with name \"" + experimentResult.getName()
              + "\" and id \"" + experimentResult.getId() + "\" was added.");
        }
      } else {
        System.out.println ("No experiments were added.");
        return;
      }

      Long experimentId = result.getValue()[0].getId();

      // Set ad group for the experiment.
      AdGroup adGroup = new AdGroup();
      adGroup.setId(adGroupId);

      // Create experiment bid multiplier rule that will modify ad group bid for
      // the experiment.
      ManualCPCAdGroupExperimentBidMultipliers adGroupExperimentBidMultipliers =
          new ManualCPCAdGroupExperimentBidMultipliers();
      adGroupExperimentBidMultipliers.setMaxCpcMultiplier(new BidMultiplier(1.5, null));

      // Set experiment data to the ad group.
      AdGroupExperimentData adGroupExperimentData = new AdGroupExperimentData();
      adGroupExperimentData.setExperimentId(experimentId);
      adGroupExperimentData.setExperimentDeltaStatus(ExperimentDeltaStatus.MODIFIED);
      adGroupExperimentData.setExperimentBidMultipliers(adGroupExperimentBidMultipliers);
      adGroup.setExperimentData(adGroupExperimentData);

      // Create operation.
      AdGroupOperation adGroupOperation = new AdGroupOperation();
      adGroupOperation.setOperand(adGroup);
      adGroupOperation.setOperator(Operator.SET);

      // Update ad group.
      adGroup = adGroupService.mutate(new AdGroupOperation[]{adGroupOperation}).getValue()[0];

      System.out.println("Ad group with name \"" + adGroup.getName() + "\" and id \""
          + adGroup.getId() + "\" was updated for the experiment.");

      // Set ad group criterion for the experiment.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.