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

Examples of com.google.api.ads.adwords.axis.v201309.cm.AdGroup


  }

  public static void runExample(AdWordsServices adWordsServices, AdWordsSession session,
      Long feedId, Map<Long, String[]> feedItemDescriptions) throws Exception {
    FeedServiceInterface feedService = adWordsServices.get(session, FeedServiceInterface.class);
    Selector selector = new Selector();
    // Do not include "Attributes" because you do not want to pass existing
    // attributes into the subsequent mutate (SET) call.
    selector.setFields(new String[] {"Id", "Attributes"});
    selector.setPredicates(new Predicate[] {
        new Predicate("Id", PredicateOperator.EQUALS, new String[] {feedId.toString()})});
    Feed feed = feedService.get(selector).getEntries()[0];

    // Add new attributes to the feed.
    FeedAttribute[] newAttributes = addLine1And2FeedAttributes(adWordsServices, session, feed);
View Full Code Here


  private static void updateFeedItems(AdWordsServices adWordsServices, AdWordsSession session,
      Long feedId, FeedAttribute line1Attribute, FeedAttribute line2Attribute,
      Map<Long, String[]> feedItemDescriptions) throws Exception {
    FeedItemServiceInterface feedItemService =
        adWordsServices.get(session, FeedItemServiceInterface.class);
    Selector itemSelector = new Selector();
    itemSelector.setFields(new String[] {"FeedId", "FeedItemId", "AttributeValues"});

    List<String> feedItemIds = Lists.newArrayList(
        Iterables.transform(feedItemDescriptions.keySet(), Functions.toStringFunction()));
    itemSelector.setPredicates(new Predicate[] {
        // Limit FeedItems to the feed.
        new Predicate("FeedId", PredicateOperator.EQUALS, new String[] {feedId.toString()}),
        // Limit FeedItems to the items in the feedItemDescriptions map.
        new Predicate("FeedItemId", PredicateOperator.IN, feedItemIds.toArray(new String[0]))});
View Full Code Here

  private static void updateFeedMapping(AdWordsServices adWordsServices, AdWordsSession session,
      Long feedId, FeedAttribute line1FeedAttribute, FeedAttribute line2FeedAttribute)
      throws Exception {
    FeedMappingServiceInterface mappingService =
        adWordsServices.get(session, FeedMappingServiceInterface.class);
    Selector selector = new Selector();
    selector.setFields(
        new String[] {"FeedId", "FeedMappingId", "PlaceholderType", "AttributeFieldMappings"});
    selector.setPredicates(new Predicate[] {
        new Predicate("FeedId", PredicateOperator.EQUALS, new String[] {feedId.toString()})});

    FeedMapping feedMapping = mappingService.get(selector).getEntries()[0];

    // Remove the existing mapping (FeedMapping is immutable).
View Full Code Here

        adWordsServices.get(session, MediaServiceInterface.class);

    int offset = 0;

    // Create selector.
    Selector selector = new Selector();
    selector.setFields(new String[] {"MediaId", "Width", "Height", "MimeType"});
    selector.setPaging(new Paging(offset, PAGE_SIZE));
    selector.setOrdering(new OrderBy[] {new OrderBy("MediaId", SortOrder.ASCENDING)});
    selector.setPaging(new Paging(offset, PAGE_SIZE));

    // Create predicates.
    Predicate typePredicate =
        new Predicate("Type", PredicateOperator.IN, new String[] {"IMAGE", "VIDEO"});
    selector.setPredicates(new Predicate[] {typePredicate});

    MediaPage page = null;

    do {
      // Get all images.
      page = mediaService.get(selector);

      // Display images.
      if (page != null && page.getEntries() != null) {
        for (Media media : page.getEntries()) {
          Map<MediaSize, Dimensions> dimensions = Maps.toMap(media.getDimensions());
          System.out.println("Media with id '" + media.getMediaId() +
              (!dimensions.isEmpty()
                  ? "', dimensions '" + dimensions.get(MediaSize.FULL).getWidth() + "x"
                    + dimensions.get(MediaSize.FULL).getHeight()
                  : "") + "', and MIME type '"
              + media.getMediaType() + "' was found.");
        }
      } else {
        System.out.println("No images/videos were found.");
      }
      offset += PAGE_SIZE;
      selector.getPaging().setStartIndex(offset);
    } while (offset < page.getTotalNumEntries());
  }
View Full Code Here

    OfflineConversionFeedServiceInterface offlineConversionFeedService =
        adWordsServices.get(session, OfflineConversionFeedServiceInterface.class);

    // Create an upload conversion. Once created, this entry will be visible
    // under Tools and Analysis->Conversion and will have "Source = Import".
    UploadConversion uploadConversion = new UploadConversion();
    uploadConversion.setCategory(ConversionTrackerCategory.PAGE_VIEW);
    uploadConversion.setName(conversionName);
    uploadConversion.setViewthroughLookbackWindow(30);
    uploadConversion.setCtcLookbackWindow(90);

    ConversionTrackerOperation uploadConversionOperation = new ConversionTrackerOperation();
    uploadConversionOperation.setOperator(Operator.ADD);
    uploadConversionOperation.setOperand(uploadConversion);

    ConversionTrackerReturnValue conversionTrackerReturnValue = conversionTrackerService.mutate(
        new ConversionTrackerOperation[] {uploadConversionOperation});

    UploadConversion newUploadConversion =
        (UploadConversion) conversionTrackerReturnValue.getValue(0);

    System.out.printf("New upload conversion type with name = '%s' and ID = %d was created.\n",
        newUploadConversion.getName(), newUploadConversion.getId());

    // Associate offline conversions with the upload conversion we created.
    OfflineConversionFeed feed = new OfflineConversionFeed();
    feed.setConversionName(conversionName);
    feed.setConversionTime(conversionTime);
View Full Code Here

    // 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);
View Full Code Here

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

    // 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);
View Full Code Here

    // 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);
View Full Code Here

    // 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());

    // Create product ad.
    AdGroupAdServiceInterface adGroupAdService =
        adWordsServices.get(session, AdGroupAdServiceInterface.class);
    ProductAd productAd = new ProductAd();

    // Create ad group ad.
    AdGroupAd adGroupAd = new AdGroupAd();
    adGroupAd.setAdGroupId(adGroup.getId());
    adGroupAd.setAd(productAd);

    // Create operation.
    AdGroupAdOperation adGroupAdOperation = new AdGroupAdOperation();
    adGroupAdOperation.setOperand(adGroupAd);
View Full Code Here

    }

    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.
    BiddableAdGroupCriterion adGroupCriterion = new BiddableAdGroupCriterion();
    adGroupCriterion.setCriterion(new Criterion(criterionId, null, null));
    adGroupCriterion.setAdGroupId(adGroupId);
View Full Code Here

TOP

Related Classes of com.google.api.ads.adwords.axis.v201309.cm.AdGroup

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.