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

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


  }

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session, Long campaignId) throws Exception {
    // Get the campaign criterion service.
    CampaignCriterionServiceInterface campaignCriterionService = adWordsServices.get(session,
        CampaignCriterionServiceInterface.class);
   
    ProductScope productScope = new ProductScope();

    // This set of dimensions is for demonstration purposes only. It would be
    // extremely unlikely that you want to include so many dimensions in your
    // product scope.
    ProductBrand productBrand = new ProductBrand();
    productBrand.setValue("Nexus");

    ProductCanonicalCondition productCanonicalCondition = new ProductCanonicalCondition();
    productCanonicalCondition.setCondition(ProductCanonicalConditionCondition.NEW);

    ProductCustomAttribute productCustomAttribute = new ProductCustomAttribute();
    productCustomAttribute.setType(ProductDimensionType.CUSTOM_ATTRIBUTE_0);
    productCustomAttribute.setValue("my attribute value");

    ProductOfferId productOfferId = new ProductOfferId();
    productOfferId.setValue("book1");

    ProductType productTypeLevel1Media = new ProductType();
    productTypeLevel1Media.setType(ProductDimensionType.PRODUCT_TYPE_L1);
    productTypeLevel1Media.setValue("Media");

    ProductType productTypeLevel2Books = new ProductType();
    productTypeLevel2Books.setType(ProductDimensionType.PRODUCT_TYPE_L2);
    productTypeLevel2Books.setValue("Books");

    // The value for the bidding category is a fixed ID for the 'Luggage & Bags'
    // category. You can retrieve IDs for categories from the ConstantDataService.
    // See the 'GetProductCategoryTaxonomy' example for more details.
    ProductBiddingCategory productBiddingCategory = new ProductBiddingCategory();
    productBiddingCategory.setType(ProductDimensionType.BIDDING_CATEGORY_L1);
    productBiddingCategory.setValue(-5914235892932915235L);
   
    productScope.setDimensions(new ProductDimension[]{ productBrand, productCanonicalCondition,
        productCustomAttribute, productOfferId, productTypeLevel1Media, productTypeLevel2Books,
        productBiddingCategory});

    CampaignCriterion campaignCriterion = new CampaignCriterion();
    campaignCriterion.setCampaignId(campaignId);
    campaignCriterion.setCriterion(productScope);
   
    // Create operation.
    CampaignCriterionOperation criterionOperation = new CampaignCriterionOperation();
    criterionOperation.setOperand(campaignCriterion);
    criterionOperation.setOperator(Operator.ADD);
   
    // Make the mutate request.
    CampaignCriterionReturnValue result =
        campaignCriterionService.mutate(new CampaignCriterionOperation[] {criterionOperation});

    // Display the result.
    System.out.printf("Created a ProductScope criterion with ID %d.%n",
        result.getValue(0).getCriterion().getId());
  }
View Full Code Here


    shoppingSetting.setMerchantId(merchantId);
   
    campaign.setSettings(new Setting[] {keywordMatchSetting, shoppingSetting});

    // Create operation.
    CampaignOperation campaignOperation = new CampaignOperation();
    campaignOperation.setOperand(campaign);
    campaignOperation.setOperator(Operator.ADD);

    // Make the mutate request.
    CampaignReturnValue campaignAddResult =
        campaignService.mutate(new CampaignOperation[] {campaignOperation});
View Full Code Here

    CampaignOperation campaignOperation = new CampaignOperation();
    campaignOperation.setOperand(campaign);
    campaignOperation.setOperator(Operator.ADD);

    // Make the mutate request.
    CampaignReturnValue campaignAddResult =
        campaignService.mutate(new CampaignOperation[] {campaignOperation});

    // Display result.
    campaign = campaignAddResult.getValue(0);

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

    // Get the AdGroupService.
View Full Code Here

  }

  public static void runExample(AdWordsServices adWordsServices, AdWordsSession session,
      Long budgetId, Long merchantId) throws Exception {
    // Get the CampaignService
    CampaignServiceInterface campaignService =
        adWordsServices.get(session, CampaignServiceInterface.class);

    // Create campaign.
    Campaign campaign = new Campaign();
    campaign.setName("Shopping campaign #" + System.currentTimeMillis());
    // The advertisingChannelType is what makes this a Shopping campaign
    campaign.setAdvertisingChannelType(AdvertisingChannelType.SHOPPING);

    // Set shared budget (required).
    Budget budget = new Budget();
    budget.setBudgetId(budgetId);
    campaign.setBudget(budget);

    // Set bidding strategy (required).
    BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();
    biddingStrategyConfiguration.setBiddingStrategyType(BiddingStrategyType.MANUAL_CPC);
    campaign.setBiddingStrategyConfiguration(biddingStrategyConfiguration);

    // Set keyword matching setting (required).
    KeywordMatchSetting keywordMatchSetting = new KeywordMatchSetting();
    keywordMatchSetting.setOptIn(false);

    // All Shopping campaigns need a ShoppingSetting.
    ShoppingSetting shoppingSetting = new ShoppingSetting();
    shoppingSetting.setSalesCountry("US");
    shoppingSetting.setCampaignPriority(0);
    shoppingSetting.setMerchantId(merchantId);
   
    campaign.setSettings(new Setting[] {keywordMatchSetting, shoppingSetting});

    // Create operation.
    CampaignOperation campaignOperation = new CampaignOperation();
    campaignOperation.setOperand(campaign);
    campaignOperation.setOperator(Operator.ADD);

    // Make the mutate request.
    CampaignReturnValue campaignAddResult =
        campaignService.mutate(new CampaignOperation[] {campaignOperation});

    // Display result.
    campaign = campaignAddResult.getValue(0);

    System.out.printf("Campaign with name '%s' and ID %d was added.%n", campaign.getName(),
View Full Code Here

  }

  public static void runExample(AdWordsServices adWordsServices, AdWordsSession session)
      throws Exception {
    // Get the constant data service.
    ConstantDataServiceInterface constantDataService =
        adWordsServices.get(session, ConstantDataServiceInterface.class);
   
    Selector selector = new SelectorBuilder()
      .equals("Country", "US")
      .build();
   
    ProductBiddingCategoryData[] results =
        constantDataService.getProductBiddingCategoryData(selector);
   
    // List of top level category nodes.
    List<CategoryNode> rootCategories = Lists.newArrayList();
    // Map of category ID to category node for all categories found in the results.
    Map<Long, CategoryNode> biddingCategories = Maps.newHashMap();
View Full Code Here

    // Get the AdGroupCriterionService.
    AdGroupCriterionServiceInterface adGroupCriterionService =
        adWordsServices.get(session, AdGroupCriterionServiceInterface.class);

    // Create base class criterion to avoid setting keyword specific fields.
    Criterion criterion = new Criterion();
    criterion.setId(criterionId);

    // Create ad group criterion.
    AdGroupCriterion adGroupCriterion = new AdGroupCriterion();
    adGroupCriterion.setAdGroupId(adGroupId);
    adGroupCriterion.setCriterion(criterion);
View Full Code Here

    // Set max date time to the current date.
    String maxDateTime = new DateTime().toString("yyyyMMdd");

    // Create selector.
    StatsSelector statsSelector = new StatsSelector();
    statsSelector.setDateRange(new DateRange(minDateTime, maxDateTime));
    statsSelector.setSegmentationDimensions(
        new SegmentationDimension[] {SegmentationDimension.DATE_MONTH});
    statsSelector.setMetrics(
        new Metric[] {Metric.VIEWS, Metric.COST, Metric.AVERAGE_CPV});
    statsSelector.setSummaryTypes(
View Full Code Here

  private static CustomizersDataHolder createCustomizerFeed(AdWordsServices adWordsServices,
      AdWordsSession session) throws Exception {
    // Get the FeedService.
    FeedServiceInterface feedService = adWordsServices.get(session, FeedServiceInterface.class);
 
    Feed customizerFeed = new Feed();
    customizerFeed.setName("CustomizerFeed");
 
    FeedAttribute nameAttribute = new FeedAttribute();
    nameAttribute.setName("Name");
    nameAttribute.setType(FeedAttributeType.STRING);
   
    FeedAttribute priceAttribute = new FeedAttribute();
    priceAttribute.setName("Price");
    priceAttribute.setType(FeedAttributeType.STRING);
   
    FeedAttribute dateAttribute = new FeedAttribute();
    dateAttribute.setName("Date");
    dateAttribute.setType(FeedAttributeType.DATE_TIME);
 
    customizerFeed.setAttributes(
        new FeedAttribute[] {nameAttribute, priceAttribute, dateAttribute});
 
    FeedOperation feedOperation = new FeedOperation();
    feedOperation.setOperand(customizerFeed);
    feedOperation.setOperator(Operator.ADD);
 
    Feed addedFeed = feedService.mutate(new FeedOperation[] {feedOperation}).getValue()[0];
 
    CustomizersDataHolder dataHolder = new CustomizersDataHolder();
    dataHolder.customizersFeedId = addedFeed.getId();
    dataHolder.nameFeedAttributeId = addedFeed.getAttributes(0).getId();
    dataHolder.priceFeedAttributeId = addedFeed.getAttributes(1).getId();
    dataHolder.dateFeedAttributeId = addedFeed.getAttributes(2).getId();
 
    System.out.printf("Feed with name '%s' and ID %d was added with:%n", addedFeed.getName(),
        dataHolder.customizersFeedId);
    System.out.printf("  Name attribute ID %d%n", dataHolder.nameFeedAttributeId);
    System.out.printf("  Price attribute ID %d%n", dataHolder.priceFeedAttributeId);
    System.out.printf("  Date attribute ID %d%n", dataHolder.dateFeedAttributeId);
 
View Full Code Here

    Selector selector = new SelectorBuilder()
        .fields("Id", "Attributes")
        .equalsId(feedId)
        .build();
    Feed feed = feedService.get(selector).getEntries()[0];

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

    FeedServiceInterface feedService = adWordsServices.get(session, FeedServiceInterface.class);
    FeedReturnValue mutateFeedResult = feedService.mutate(new FeedOperation[] {feedOperation});

    // Get the new attributes from the mutated feed.
    Feed mutatedFeed = mutateFeedResult.getValue()[0];
    line1Attribute = mutatedFeed.getAttributes(nextAttributeIndex);
    line2Attribute = mutatedFeed.getAttributes(nextAttributeIndex + 1);
    return new FeedAttribute[] {line1Attribute, line2Attribute};
  }
View Full Code Here

TOP

Related Classes of com.google.api.ads.adwords.axis.v201406.cm.Feed

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.