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

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


    operation.setOperator(Operator.SET);

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

    // Add video call to action.
    VideoReturnValue result = videoService.mutateCallToAction(operations);

    for (YouTubeVideo youTubeVideoResult : result.getValue()) {
      System.out.printf("CallToAction overlay was added to video ID %s, "
          + "headline '%s'.%n",
          youTubeVideoResult.getId(),
          youTubeVideoResult.getCallToAction().getCreative().getHeadline());
    }
View Full Code Here


    selector.setSearchType(VideoSearchSelectorSearchType.VIDEO);
    selector.setQuery(query);
    selector.setPaging(new Paging(0, PAGE_SIZE));

    // Run the query.
    VideoSearchPage page = videoService.search(selector);

    // Display videos.
    if (page.getTotalNumEntries() > 0) {
      for (YouTubeVideo video : page.getEntries()) {
        System.out.printf("YouTube video id %s with title '%s' found.%n",
            video.getId(),
            video.getTitle());
      }
      System.out.printf("Total number of matching videos: %d.%n",
          page.getTotalNumEntries());
    } else {
      System.out.printf("No videos matching '%s' were found.%n", query);
    }
  }
View Full Code Here

    // Get the VideoCampaignService.
    VideoServiceInterface videoService = adWordsServices.get(session, VideoServiceInterface.class);

    // Create a selector.
    VideoSearchSelector selector = new VideoSearchSelector();
    selector.setSearchType(VideoSearchSelectorSearchType.VIDEO);
    selector.setQuery(query);
    selector.setPaging(new Paging(0, PAGE_SIZE));

    // Run the query.
    VideoSearchPage page = videoService.search(selector);

    // Display videos.
View Full Code Here

  public static void runExample(AdWordsServices adWordsServices,
      AdWordsSession session, String query)
      throws Exception {

    // Get the VideoCampaignService.
    VideoServiceInterface videoService = adWordsServices.get(session, VideoServiceInterface.class);

    // Create a selector.
    VideoSearchSelector selector = new VideoSearchSelector();
    selector.setSearchType(VideoSearchSelectorSearchType.VIDEO);
    selector.setQuery(query);
    selector.setPaging(new Paging(0, PAGE_SIZE));

    // Run the query.
    VideoSearchPage page = videoService.search(selector);

    // Display videos.
    if (page.getTotalNumEntries() > 0) {
      for (YouTubeVideo video : page.getEntries()) {
        System.out.printf("YouTube video id %s with title '%s' found.%n",
View Full Code Here

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session, String videoId)
          throws Exception {
    // Get the VideoService.
    VideoServiceInterface videoService =
        adWordsServices.get(session, VideoServiceInterface.class);

    // Create the call to action.
    VideoCallToAction videoCallToAction = new VideoCallToAction();
    videoCallToAction.setId(videoId);
   
    CallToAction callToAction = new CallToAction();
    CallToActionCreative callToActionCreative = new CallToActionCreative();
    callToActionCreative.setHeadline("Mars cruise");
    callToActionCreative.setDisplayUrl("www.example.com/mars");
    callToActionCreative.setDestinationUrl("www.example.com/mars");
    callToAction.setCreative(callToActionCreative);
    videoCallToAction.setCallToAction(callToAction);

    VideoCallToActionOperation operation = new VideoCallToActionOperation();
    operation.setOperand(videoCallToAction);
   
    // Use SET to add a new Call to Action, or to overwrite an existing one.
    operation.setOperator(Operator.SET);

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

    // Add video call to action.
    VideoReturnValue result = videoService.mutateCallToAction(operations);

    for (YouTubeVideo youTubeVideoResult : result.getValue()) {
      System.out.printf("CallToAction overlay was added to video ID %s, "
          + "headline '%s'.%n",
          youTubeVideoResult.getId(),
View Full Code Here

  public static void runExample(AdWordsServices adWordsServices,
      AdWordsSession session, Long campaignId, Long targetingGroupId)
      throws Exception {
    // Get the VideoTargetingGroupCriterionService
    VideoTargetingGroupCriterionServiceInterface videoTargetingGroupCriterionService =
        adWordsServices.get(session, VideoTargetingGroupCriterionServiceInterface.class);

    // Create an age criterion for age range 18 to 24.
    TargetingGroupCriterion ageCriterion = new TargetingGroupCriterion();
    ageCriterion.setCampaignId(campaignId);
    ageCriterion.setTargetingGroupId(targetingGroupId);
    AudienceAge age = new AudienceAge();
    age.setAgeRange(AudienceAgeAgeRange.AGE_RANGE_18_24);
    ageCriterion.setCriterion(age);

    TargetingGroupCriterionOperation addAgeCriterionOp =
        new TargetingGroupCriterionOperation();
    addAgeCriterionOp.setOperand(ageCriterion);
    addAgeCriterionOp.setOperator(Operator.ADD);
   
    // Create a negative age criterion for age 65+.
    NegativeTargetingGroupCriterion negativeAgeCriterion =
        new NegativeTargetingGroupCriterion();
    negativeAgeCriterion.setCampaignId(campaignId);
    negativeAgeCriterion.setTargetingGroupId(targetingGroupId);
    AudienceAge negativeAge = new AudienceAge();
    negativeAge.setAgeRange(AudienceAgeAgeRange.AGE_RANGE_65_UP);
    negativeAgeCriterion.setCriterion(negativeAge);

    TargetingGroupCriterionOperation addNegativeAgeCriterionOp =
        new TargetingGroupCriterionOperation();
    addNegativeAgeCriterionOp.setOperand(negativeAgeCriterion);
    addNegativeAgeCriterionOp.setOperator(Operator.ADD);

    // Create a gender criterion for male.
    TargetingGroupCriterion genderCriterion = new TargetingGroupCriterion();
    AudienceGender gender = new AudienceGender();
    gender.setGenderType(AudienceGenderGenderType.GENDER_MALE);
    genderCriterion.setCampaignId(campaignId);
    genderCriterion.setTargetingGroupId(targetingGroupId);
    genderCriterion.setCriterion(gender);

    TargetingGroupCriterionOperation addGenderCriterionOp =
        new TargetingGroupCriterionOperation();
    addGenderCriterionOp.setOperand(genderCriterion);
    addGenderCriterionOp.setOperator(Operator.ADD);

    // Create a topic criterion for the Autos & Vehicles topic.
    // See ConstantDataService for a list of verticals.
    TargetingGroupCriterion topicCriterion = new TargetingGroupCriterion();
    Topic topic = new Topic();
    topic.setVerticalId(47L);
    topicCriterion.setCampaignId(campaignId);
    topicCriterion.setTargetingGroupId(targetingGroupId);
    topicCriterion.setCriterion(topic);

    TargetingGroupCriterionOperation addTopicCriterionOp =
        new TargetingGroupCriterionOperation();
    addTopicCriterionOp.setOperand(topicCriterion);
    addTopicCriterionOp.setOperator(Operator.ADD);

    // Create an interest criterion for the Tablet PC interest.
    // See ConstantDataService for a list of verticals.
    TargetingGroupCriterion interestCriterion = new TargetingGroupCriterion();
    AudienceInterest interest = new AudienceInterest();
    interest.setInterestId(1277L);

    interestCriterion.setCampaignId(campaignId);
    interestCriterion.setTargetingGroupId(targetingGroupId);
    interestCriterion.setCriterion(interest);

    TargetingGroupCriterionOperation addUserInterestCriteriaOp =
        new TargetingGroupCriterionOperation();
    addUserInterestCriteriaOp.setOperand(interestCriterion);
    addUserInterestCriteriaOp.setOperator(Operator.ADD);

    TargetingGroupCriterionReturnValue result = videoTargetingGroupCriterionService.mutate(
        new TargetingGroupCriterionOperation[] {
          addAgeCriterionOp, addGenderCriterionOp,
          addNegativeAgeCriterionOp, addTopicCriterionOp,
          addUserInterestCriteriaOp});
   
View Full Code Here

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session,
      Long targetingGroupId) throws Exception {
    // Get the VideoCampaignCriterionService.
    VideoTargetingGroupCriterionServiceInterface videoTargetingGroupCriterionService =
        adWordsServices.get(session, VideoTargetingGroupCriterionServiceInterface.class);

    int offset = 0;

    // Create selector.
    TargetingGroupCriterionSelector selector = new TargetingGroupCriterionSelector();
    selector.setTargetingGroupIds(new long[] {targetingGroupId});
    selector.setCriteriaDimension(CriteriaDimension.KEYWORD);
    selector.setPaging(new Paging(offset, PAGE_SIZE));

    TargetingGroupCriterionPage page;
    do {
      // Get all criteria for the campaign.
      page = videoTargetingGroupCriterionService.get(selector);

      // Display criteria.
      if (page.getEntries() != null) {
        for (TargetingGroupCriterion targetingGroupCampaignCriterion : page.getEntries()) {
          String negative =
View Full Code Here

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

        user.getService(AdWordsService.V201306.CAMPAIGN_FEED_SERVICE);

    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.INTEGER);
      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

        user.getService(AdWordsService.V201309.CAMPAIGN_FEED_SERVICE);

    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.INTEGER);
      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

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.