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

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


    // Create a custom matching function that matches the given feed items to
    // the campaign.
    RequestContextOperand requestContextOperand = new RequestContextOperand();
    requestContextOperand.setContextType(RequestContextOperandContextType.FEED_ITEM_ID);

    Function function = new Function();
    function.setLhsOperand(new FunctionArgumentOperand[] {requestContextOperand});
    function.setOperator(FunctionOperator.IN);

    List<FunctionArgumentOperand> operands = new ArrayList<FunctionArgumentOperand>();
    for (long feedItemId : siteLinkFeedItemIds) {
      ConstantOperand constantOperand = new ConstantOperand();
      constantOperand.setLongValue(feedItemId);
      constantOperand.setType(ConstantOperandConstantType.LONG);
      operands.add(constantOperand);
    }
    function.setRhsOperand(operands.toArray(new FunctionArgumentOperand[operands.size()]));

    // Create upgraded sitelinks for the campaign. Use the sitelinks feed we
    // created, and restrict feed items by matching function.
    CampaignFeed campaignFeed = new CampaignFeed();
    campaignFeed.setFeedId(siteLinksFeed.siteLinksFeedId);
View Full Code Here


        adWordsServices.get(session, CampaignFeedServiceInterface.class);

    RequestContextOperand requestContextOperand = new RequestContextOperand();
    requestContextOperand.setContextType(RequestContextOperandContextType.FEED_ITEM_ID);

    Function feedItemFunction = new Function();
    feedItemFunction.setLhsOperand(new FunctionArgumentOperand[] {requestContextOperand});
    feedItemFunction.setOperator(FunctionOperator.IN);

    List<FunctionArgumentOperand> operands = new ArrayList<FunctionArgumentOperand>();
    for (long feedItemId : siteLinksData.siteLinkFeedItemIds) {
      ConstantOperand constantOperand = new ConstantOperand();
      constantOperand.setLongValue(feedItemId);
      constantOperand.setType(ConstantOperandConstantType.LONG);
      operands.add(constantOperand);
    }
    feedItemFunction.setRhsOperand(operands.toArray(new FunctionArgumentOperand[operands.size()]));

    // Optional: to target to a platform, define a function and 'AND' it with
    // the feed item ID link:
    RequestContextOperand platformRequestContextOperand = new RequestContextOperand();
    platformRequestContextOperand.setContextType(RequestContextOperandContextType.DEVICE_PLATFORM);

    ConstantOperand platformOperand = new ConstantOperand();
    platformOperand.setStringValue("Mobile");
    platformOperand.setType(ConstantOperandConstantType.STRING);

    Function platformFunction = new Function();
    platformFunction.setLhsOperand(new FunctionArgumentOperand[] {platformRequestContextOperand});
    platformFunction.setOperator(FunctionOperator.EQUALS);
    platformFunction.setRhsOperand(new FunctionArgumentOperand[] {platformOperand});

    // Combine the two functions using an AND operation.
    FunctionOperand feedItemFunctionOperand = new FunctionOperand();
    feedItemFunctionOperand.setValue(feedItemFunction);

    FunctionOperand platformFunctionOperand = new FunctionOperand();
    platformFunctionOperand.setValue(platformFunction);

    Function combinedFunction = new Function();
    combinedFunction.setOperator(FunctionOperator.AND);
    combinedFunction.setLhsOperand(new FunctionArgumentOperand[] {
        feedItemFunctionOperand, platformFunctionOperand});

    CampaignFeed campaignFeed = new CampaignFeed();
    campaignFeed.setFeedId(siteLinksData.siteLinksFeedId);
    campaignFeed.setCampaignId(campaignId);
View Full Code Here

        adWordsServices.get(session, CampaignFeedServiceInterface.class);

    RequestContextOperand requestContextOperand = new RequestContextOperand();
    requestContextOperand.setContextType(RequestContextOperandContextType.FEED_ITEM_ID);

    Function feedItemFunction = new Function();
    feedItemFunction.setLhsOperand(new FunctionArgumentOperand[] {requestContextOperand});
    feedItemFunction.setOperator(FunctionOperator.IN);

    List<FunctionArgumentOperand> operands = new ArrayList<FunctionArgumentOperand>();
    for (long feedItemId : siteLinksData.siteLinkFeedItemIds) {
      ConstantOperand constantOperand = new ConstantOperand();
      constantOperand.setLongValue(feedItemId);
      constantOperand.setType(ConstantOperandConstantType.LONG);
      operands.add(constantOperand);
    }
    feedItemFunction.setRhsOperand(operands.toArray(new FunctionArgumentOperand[operands.size()]));

    // Optional: to target to a platform, define a function and 'AND' it with
    // the feed item ID link:
    RequestContextOperand platformRequestContextOperand = new RequestContextOperand();
    platformRequestContextOperand.setContextType(RequestContextOperandContextType.DEVICE_PLATFORM);

    ConstantOperand platformOperand = new ConstantOperand();
    platformOperand.setStringValue("Mobile");
    platformOperand.setType(ConstantOperandConstantType.STRING);

    Function platformFunction = new Function();
    platformFunction.setLhsOperand(new FunctionArgumentOperand[] {platformRequestContextOperand});
    platformFunction.setOperator(FunctionOperator.EQUALS);
    platformFunction.setRhsOperand(new FunctionArgumentOperand[] {platformOperand});

    // Combine the two functions using an AND operation.
    FunctionOperand feedItemFunctionOperand = new FunctionOperand();
    feedItemFunctionOperand.setValue(feedItemFunction);

    FunctionOperand platformFunctionOperand = new FunctionOperand();
    platformFunctionOperand.setValue(platformFunction);

    Function combinedFunction = new Function();
    combinedFunction.setOperator(FunctionOperator.AND);
    combinedFunction.setLhsOperand(
        new FunctionArgumentOperand[] {feedItemFunctionOperand, platformFunctionOperand});

    CampaignFeed campaignFeed = new CampaignFeed();
    campaignFeed.setFeedId(siteLinksData.siteLinksFeedId);
    campaignFeed.setCampaignId(campaignId);
View Full Code Here

   
    // Location groups criteria. These represent targeting by household income
    // or places of interest. The IDs can be found in the documentation or
    // retrieved with the LocationCriterionService.
    LocationGroups locationGroupTier3 = new LocationGroups();
    Function tier3MatchingFunction = new Function();
    tier3MatchingFunction.setLhsOperand(new FunctionArgumentOperand[] {
        // Tiers are numbered 1-10, and represent 10% segments of earners.
        // For example, TIER_1 is the top 10%, TIER_2 is the 80-90%, etc.
        // Tiers 6 through 10 are grouped into TIER_6_TO_10.
        new IncomeOperand(null, IncomeTier.TIER_3)
    });
    tier3MatchingFunction.setOperator(FunctionOperator.AND);
    tier3MatchingFunction.setRhsOperand(new FunctionArgumentOperand[] {
        new GeoTargetOperand(null, new long[]{ 1015116L }) // Miami, FL
    });
    locationGroupTier3.setMatchingFunction(tier3MatchingFunction);

    LocationGroups locationGroupDowntown = new LocationGroups();
    Function downtownMatchingFunction = new Function();
    downtownMatchingFunction.setLhsOperand(new FunctionArgumentOperand[] {
        new PlacesOfInterestOperand(null, PlacesOfInterestOperandCategory.DOWNTOWN)
    });
    downtownMatchingFunction.setOperator(FunctionOperator.AND);
    downtownMatchingFunction.setRhsOperand(new FunctionArgumentOperand[] {
        new GeoTargetOperand(null, new long[]{ 1015116L }) // Miami, FL
    });
    locationGroupDowntown.setMatchingFunction(downtownMatchingFunction);

    List<CampaignCriterionOperation> operations = new ArrayList<CampaignCriterionOperation>();
View Full Code Here

        adWordsServices.get(session, CampaignFeedServiceInterface.class);

    RequestContextOperand requestContextOperand = new RequestContextOperand();
    requestContextOperand.setContextType(RequestContextOperandContextType.FEED_ITEM_ID);

    Function feedItemFunction = new Function();
    feedItemFunction.setLhsOperand(new FunctionArgumentOperand[] {requestContextOperand});
    feedItemFunction.setOperator(FunctionOperator.IN);

    List<FunctionArgumentOperand> operands = new ArrayList<FunctionArgumentOperand>();
    for (long feedItemId : siteLinksData.siteLinkFeedItemIds) {
      ConstantOperand constantOperand = new ConstantOperand();
      constantOperand.setLongValue(feedItemId);
      constantOperand.setType(ConstantOperandConstantType.LONG);
      operands.add(constantOperand);
    }
    feedItemFunction.setRhsOperand(operands.toArray(new FunctionArgumentOperand[operands.size()]));

    // Optional: to target to a platform, define a function and 'AND' it with
    // the feed item ID link:
    RequestContextOperand platformRequestContextOperand = new RequestContextOperand();
    platformRequestContextOperand.setContextType(RequestContextOperandContextType.DEVICE_PLATFORM);

    ConstantOperand platformOperand = new ConstantOperand();
    platformOperand.setStringValue("Mobile");
    platformOperand.setType(ConstantOperandConstantType.STRING);

    Function platformFunction = new Function();
    platformFunction.setLhsOperand(new FunctionArgumentOperand[] {platformRequestContextOperand});
    platformFunction.setOperator(FunctionOperator.EQUALS);
    platformFunction.setRhsOperand(new FunctionArgumentOperand[] {platformOperand});

    // Combine the two functions using an AND operation.
    FunctionOperand feedItemFunctionOperand = new FunctionOperand();
    feedItemFunctionOperand.setValue(feedItemFunction);

    FunctionOperand platformFunctionOperand = new FunctionOperand();
    platformFunctionOperand.setValue(platformFunction);

    Function combinedFunction = new Function();
    combinedFunction.setOperator(FunctionOperator.AND);
    combinedFunction.setLhsOperand(
        new FunctionArgumentOperand[] {feedItemFunctionOperand, platformFunctionOperand});

    CampaignFeed campaignFeed = new CampaignFeed();
    campaignFeed.setFeedId(siteLinksData.siteLinksFeedId);
    campaignFeed.setCampaignId(campaignId);
View Full Code Here

    CustomerFeed customerFeed = new CustomerFeed();
    customerFeed.setFeedId(addedFeed.getId());
    customerFeed.setPlaceholderTypes(new int[] {PLACEHOLDER_LOCATION});

    // Create a matching function that will always evaluate to true.
    Function customerMatchingFunction = new Function();
    ConstantOperand constOperand = new ConstantOperand();
    constOperand.setType(ConstantOperandConstantType.BOOLEAN);
    constOperand.setBooleanValue(true);
    customerMatchingFunction.setLhsOperand(new FunctionArgumentOperand[] {constOperand});
    customerMatchingFunction.setOperator(FunctionOperator.IDENTITY);
    customerFeed.setMatchingFunction(customerMatchingFunction);

    // Create an operation to add the customer feed.
    CustomerFeedOperation customerFeedOperation = new CustomerFeedOperation();
    customerFeedOperation.setOperand(customerFeed);
View Full Code Here

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

    // Create operations.
    AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
    operation.setOperand(adGroupCriterion);
    operation.setOperator(Operator.REMOVE);
View Full Code Here

    AdGroupCriterion adGroupCriterion = new AdGroupCriterion();
    adGroupCriterion.setAdGroupId(adGroupId);
    adGroupCriterion.setCriterion(criterion);

    // Create operations.
    AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
    operation.setOperand(adGroupCriterion);
    operation.setOperator(Operator.REMOVE);

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

    // Remove ad group criteria.
    AdGroupCriterionReturnValue result = adGroupCriterionService.mutate(operations);
View Full Code Here

    operation.setOperator(Operator.REMOVE);

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

    // Remove ad group criteria.
    AdGroupCriterionReturnValue result = adGroupCriterionService.mutate(operations);

    // Display ad group criteria.
    for (AdGroupCriterion adGroupCriterionResult : result.getValue()) {
      System.out.println("Ad group criterion with ad group id \""
          + adGroupCriterionResult.getAdGroupId() + "\", criterion id \""
          + adGroupCriterionResult.getCriterion().getId() + "\", and type \""
          + adGroupCriterionResult.getCriterion().getCriterionType() + "\" was removed.");
    }
View Full Code Here

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session, long adGroupId,
      long criterionId) throws Exception {
    // 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);

    // Create operations.
    AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
    operation.setOperand(adGroupCriterion);
    operation.setOperator(Operator.REMOVE);

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

    // Remove ad group criteria.
    AdGroupCriterionReturnValue result = adGroupCriterionService.mutate(operations);

    // Display ad group criteria.
    for (AdGroupCriterion adGroupCriterionResult : result.getValue()) {
      System.out.println("Ad group criterion with ad group id \""
          + adGroupCriterionResult.getAdGroupId() + "\", criterion id \""
View Full Code Here

TOP

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

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.