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

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


  }

  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

    // Get the MediaService.
    MediaServiceInterface mediaService =
        adWordsServices.get(session, MediaServiceInterface.class);

    // Create image.
    Image image = new Image();
    image.setData(
        com.google.api.ads.common.lib.utils.Media.getMediaDataFromUrl("http://goo.gl/HJM3L"));
    image.setType(MediaMediaType.IMAGE);

    Media[] media = new Media[] {image};

    // Upload image.
    Media[] result = mediaService.upload(media);

    // Display images.
    image = (Image) result[0];
    Map<MediaSize, Dimensions> dimensions = Maps.toMap(image.getDimensions());
    System.out.println("Image with id '" + image.getMediaId() + "', dimensions '"
        + dimensions.get(MediaSize.FULL).getWidth() + "x"
        + dimensions.get(MediaSize.FULL).getHeight() + "', and MIME type '" + image.getMediaType()
        + "' was uploaded.");
  }
View Full Code Here

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

    List<CampaignEstimateRequest> campaignEstimateRequests =
        new ArrayList<CampaignEstimateRequest>();
    CampaignEstimateRequest campaignEstimateRequest = new CampaignEstimateRequest();
    campaignEstimateRequest.setAdGroupEstimateRequests(adGroupEstimateRequests
        .toArray(new AdGroupEstimateRequest[] {}));
    Location unitedStates = new Location();
    unitedStates.setId(2840L);
    Language english = new Language();
    english.setId(1000L);
    campaignEstimateRequest.setCriteria(new Criterion[] {unitedStates, english});
    campaignEstimateRequests.add(campaignEstimateRequest);
View Full Code Here

    // Criterion - Mountain View, California location.
    // The ID can be found in the documentation:
    // https://developers.google.com/adwords/api/docs/appendix/geotargeting
    // https://developers.google.com/adwords/api/docs/appendix/cities-DMAregions
    Location location = new Location();
    location.setId(1014044L);
    criteria.add(location);

    selector.setCriteria(criteria.toArray(new Criterion[criteria.size()]));

    BudgetSuggestion budgetSuggestion = service.get(selector);
View Full Code Here

    CampaignCriterionServiceInterface campaignCriterionService =
        adWordsServices.get(session, CampaignCriterionServiceInterface.class);

    // Create locations. The IDs can be found in the documentation or
    // retrieved with the LocationCriterionService.
    Location california = new Location();
    california.setId(21137L);
    Location mexico = new Location();
    mexico.setId(2484L);

    // Create languages. The IDs can be found in the documentation or
    // retrieved with the ConstantDataService.
    Language english = new Language();
    english.setId(1000L);
View Full Code Here

        .offset(offset)
        .limit(PAGE_SIZE)
        .in("Type", "IMAGE", "VIDEO")
        .build();

    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.printf("Media with ID %d, dimensions %s, and MIME type '%s' was found.%n",
              media.getMediaId(), toString(dimensions.get(MediaSize.FULL)), media.getMediaType());
        }
      } else {
        System.out.println("No images/videos were found.");
      }
      offset += PAGE_SIZE;
      selector = builder.increaseOffsetBy(PAGE_SIZE).build();
    } while (offset < page.getTotalNumEntries());
  }
View Full Code Here

TOP

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

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.