Examples of AdGroupServiceInterface


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 campaignId = Long.parseLong("INSERT_CAMPAIGN_ID_HERE");

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

      // Create predicates.
      Predicate campaignIdPredicate =
          new Predicate("CampaignId", PredicateOperator.IN, new String[] {campaignId.toString()});
      selector.setPredicates(new Predicate[] {campaignIdPredicate});

      // Get all ad groups.
      AdGroupPage page = adGroupService.get(selector);

      // Display ad groups.
      if (page.getEntries() != null) {
        for (AdGroup adGroup : page.getEntries()) {
          System.out.println("Ad group with name \"" + adGroup.getName()
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 campaignId = Long.parseLong("INSERT_CAMPAIGN_ID_HERE");

      // 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});
      adGroup.setSettings(new Setting[] {targeting});

      // Created the bids.
      BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();
      CpcBid cpcBid = new CpcBid();
      cpcBid.setBid(new Money(null, 1000000L));
      biddingConfig.setBids(new Bids[] {cpcBid});
      adGroup.setBiddingStrategyConfiguration(biddingConfig);
     
      // Create operations.
      AdGroupOperation operation = new AdGroupOperation();
      operation.setOperand(adGroup);
      operation.setOperator(Operator.ADD);

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

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

      // Display new 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 campaignId = Long.parseLong("INSERT_CAMPAIGN_ID_HERE");

      // 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});
      adGroup.setSettings(new Setting[] {targeting});

      BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();
      CpmBid cpmBid = new CpmBid();
      cpmBid.setBid(new Money(null, 1000000L));
      biddingConfig.setBids(new Bids[] {cpmBid});
      adGroup.setBiddingStrategyConfiguration(biddingConfig);

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

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

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

      // Display new 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.v201309.cm.AdGroupServiceInterface

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

      // Get the AdGroupService.
      AdGroupServiceInterface adGroupService =
          user.getService(AdWordsService.V201309.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.v201309.cm.AdGroupServiceInterface

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

      // Get the AdGroupService.
      AdGroupServiceInterface adGroupService =
          user.getService(AdWordsService.V201309.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.v201309.cm.AdGroupServiceInterface

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

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

      // Get the AdGroupCriterionService.
      AdGroupCriterionServiceInterface adGroupCriterionService =
          user.getService(AdWordsService.V201309.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

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

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

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

      Long campaignId = Long.parseLong("INSERT_CAMPAIGN_ID_HERE");

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

      // Create predicates.
      Predicate campaignIdPredicate =
          new Predicate("CampaignId", PredicateOperator.IN, new String[] {campaignId.toString()});
      selector.setPredicates(new Predicate[] {campaignIdPredicate});

      // Get all ad groups.
      AdGroupPage page = adGroupService.get(selector);

      // Display ad groups.
      if (page.getEntries() != null) {
        for (AdGroup adGroup : page.getEntries()) {
          System.out.println("Ad group with name \"" + adGroup.getName()
View Full Code Here

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

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

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

      long campaignId = Long.parseLong("INSERT_CAMPAIGN_ID_HERE");

      // 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});
      adGroup.setSettings(new Setting[] {targeting});

      // Created the bids.
      BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();
      CpcBid cpcBid = new CpcBid();
      cpcBid.setBid(new Money(null, 1000000L));
      biddingConfig.setBids(new Bids[] {cpcBid});
      adGroup.setBiddingStrategyConfiguration(biddingConfig);
     
      // Create operations.
      AdGroupOperation operation = new AdGroupOperation();
      operation.setOperand(adGroup);
      operation.setOperator(Operator.ADD);

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

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

      // Display new 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.v201309.cm.AdGroupServiceInterface

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

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

      long campaignId = Long.parseLong("INSERT_CAMPAIGN_ID_HERE");

      // 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});
      adGroup.setSettings(new Setting[] {targeting});

      BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();
      CpmBid cpmBid = new CpmBid();
      cpmBid.setBid(new Money(null, 1000000L));
      biddingConfig.setBids(new Bids[] {cpmBid});
      adGroup.setBiddingStrategyConfiguration(biddingConfig);

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

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

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

      // Display new 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
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.