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

Examples of com.google.api.adwords.v201309.cm.AdGroupAdPage


    OfflineConversionFeedServiceInterface offlineConversionFeedService =
        user.getService(AdWordsService.V201309.OFFLINE_CONVERSION_FEED_SERVICE);

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


      // Create selector.
      Selector selector = new Selector();
      selector.setFields(new String[] {"Login", "CustomerId"});

      // Get results.
      ManagedCustomerPage page = managedCustomerService.get(selector);

      if (page.getEntries() != null) {
        // Create map from customerId to customer node.
        Map<Long, ManagedCustomerTreeNode> customerIdToCustomerNode =
            new HashMap<Long, ManagedCustomerTreeNode>();

        // Create account tree nodes for each customer.
        for (ManagedCustomer customer : page.getEntries()) {
          ManagedCustomerTreeNode node = new ManagedCustomerTreeNode();
          node.managedCustomer = customer;
          customerIdToCustomerNode.put(customer.getCustomerId(), node);
        }

        // For each link, connect nodes in tree.
        if (page.getLinks() != null) {
          for (ManagedCustomerLink link : page.getLinks()) {
            ManagedCustomerTreeNode managerNode = customerIdToCustomerNode.get(
                link.getManagerCustomerId());
            ManagedCustomerTreeNode childNode = customerIdToCustomerNode.get(
                link.getClientCustomerId());
            childNode.parentNode = managerNode;
            if (managerNode != null) {
              managerNode.childAccounts.add(childNode);
            }
          }
        }

        // Find the root account node in the tree.
        ManagedCustomerTreeNode rootNode = null;
        for (ManagedCustomer account : page.getEntries()) {
          if (customerIdToCustomerNode.get(account.getCustomerId()).parentNode == null) {
            rootNode = customerIdToCustomerNode.get(account.getCustomerId());
            break;
          }
        }
View Full Code Here

      // Get AdWordsUser from "~/adwords.properties".
      AdWordsUser user = new AdWordsUser().generateClientAdWordsUser(null);

      // Get the ServicedAccountService.
      ManagedCustomerServiceInterface managedCustomerService =
          user.getService(AdWordsService.V201309.MANAGED_CUSTOMER_SERVICE);

      // Create selector.
      Selector selector = new Selector();
      selector.setFields(new String[] {"Login", "CustomerId"});

      // Get results.
      ManagedCustomerPage page = managedCustomerService.get(selector);

      if (page.getEntries() != null) {
        // Create map from customerId to customer node.
        Map<Long, ManagedCustomerTreeNode> customerIdToCustomerNode =
            new HashMap<Long, ManagedCustomerTreeNode>();
View Full Code Here

      keywordEstimateRequests.add(negativeKeywordEstimateRequest);

      // Create ad group estimate requests.
      List<AdGroupEstimateRequest> adGroupEstimateRequests =
          new ArrayList<AdGroupEstimateRequest>();
      AdGroupEstimateRequest adGroupEstimateRequest = new AdGroupEstimateRequest();
      adGroupEstimateRequest.setKeywordEstimateRequests(
          keywordEstimateRequests.toArray(new KeywordEstimateRequest[]{}));
      adGroupEstimateRequest.setMaxCpc(new Money(null, 1000000L));
      adGroupEstimateRequests.add(adGroupEstimateRequest);

      // Create campaign estimate requests.
      List<CampaignEstimateRequest> campaignEstimateRequests =
        new ArrayList<CampaignEstimateRequest>();
View Full Code Here

      adGroupEstimateRequests.add(adGroupEstimateRequest);

      // Create campaign estimate requests.
      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);

      // Create selector.
      TrafficEstimatorSelector selector = new TrafficEstimatorSelector();
      selector.setCampaignEstimateRequests(
View Full Code Here

      if (result != null && result.getCampaignEstimates() != null) {
        KeywordEstimate[] keywordEstimates =
            result.getCampaignEstimates()[0].getAdGroupEstimates()[0].getKeywordEstimates();
        for (int i = 0; i < keywordEstimates.length; i++) {
          Keyword keyword = keywordEstimateRequests.get(i).getKeyword();
          KeywordEstimate keywordEstimate = keywordEstimates[i];
          if (Boolean.TRUE.equals(keywordEstimateRequests.get(i).getIsNegative())) {
            continue;
          }

          // Find the mean of the min and max values.
          double meanAverageCpc = (keywordEstimate.getMin().getAverageCpc().getMicroAmount()
              + keywordEstimate.getMax().getAverageCpc().getMicroAmount()) / 2.0;
          double meanAveragePosition = (keywordEstimate.getMin().getAveragePosition()
              + keywordEstimate.getMax().getAveragePosition()) / 2.0;
          double meanClicks = (keywordEstimate.getMin().getClicksPerDay()
              + keywordEstimate.getMax().getClicksPerDay()) / 2.0;
          double meanTotalCost = (keywordEstimate.getMin().getTotalCost().getMicroAmount()
              + keywordEstimate.getMax().getTotalCost().getMicroAmount()) / 2.0;

          System.out.println(String.format(
              "Results for the keyword with text '%s' and match type '%s':",
              keyword.getText(), keyword.getMatchType()));
          System.out.printf("\tEstimated average CPC: %.2f\n", meanAverageCpc);
View Full Code Here

      // Create a keyword estimate request for each keyword.
      List<KeywordEstimateRequest> keywordEstimateRequests =
          new ArrayList<KeywordEstimateRequest>();
      for (Keyword keyword : keywords) {
        KeywordEstimateRequest keywordEstimateRequest = new KeywordEstimateRequest();
        keywordEstimateRequest.setKeyword(keyword);
        keywordEstimateRequests.add(keywordEstimateRequest);
      }

      // Add a negative keyword to the traffic estimate.
      KeywordEstimateRequest negativeKeywordEstimateRequest = new KeywordEstimateRequest();
      negativeKeywordEstimateRequest.setKeyword(new Keyword(null, null, null, "hiking tour",
          KeywordMatchType.BROAD));
      negativeKeywordEstimateRequest.setIsNegative(true);
      keywordEstimateRequests.add(negativeKeywordEstimateRequest);

      // Create ad group estimate requests.
      List<AdGroupEstimateRequest> adGroupEstimateRequests =
          new ArrayList<AdGroupEstimateRequest>();
View Full Code Here

      TrafficEstimatorSelector selector = new TrafficEstimatorSelector();
      selector.setCampaignEstimateRequests(
          campaignEstimateRequests.toArray(new CampaignEstimateRequest[]{}));

      // Get traffic estimates.
      TrafficEstimatorResult result = trafficEstimatorService.get(selector);

      // Display traffic estimates.
      if (result != null && result.getCampaignEstimates() != null) {
        KeywordEstimate[] keywordEstimates =
            result.getCampaignEstimates()[0].getAdGroupEstimates()[0].getKeywordEstimates();
        for (int i = 0; i < keywordEstimates.length; i++) {
          Keyword keyword = keywordEstimateRequests.get(i).getKeyword();
          KeywordEstimate keywordEstimate = keywordEstimates[i];
          if (Boolean.TRUE.equals(keywordEstimateRequests.get(i).getIsNegative())) {
            continue;
View Full Code Here

      english.setId(1000L);
      campaignEstimateRequest.setCriteria(new Criterion[]{unitedStates, english});
      campaignEstimateRequests.add(campaignEstimateRequest);

      // Create selector.
      TrafficEstimatorSelector selector = new TrafficEstimatorSelector();
      selector.setCampaignEstimateRequests(
          campaignEstimateRequests.toArray(new CampaignEstimateRequest[]{}));

      // Get traffic estimates.
      TrafficEstimatorResult result = trafficEstimatorService.get(selector);
View Full Code Here

      // Get AdWordsUser from "~/adwords.properties".
      AdWordsUser user = new AdWordsUser();

      // Get the TrafficEstimatorService.
      TrafficEstimatorServiceInterface trafficEstimatorService =
          user.getService(AdWordsService.V201309.TRAFFIC_ESTIMATOR_SERVICE);

      // Create keywords. Up to 2000 keywords can be passed in a single request.
      List<Keyword> keywords = new ArrayList<Keyword>();
      keywords.add(new Keyword(null, null, null, "mars cruise", KeywordMatchType.BROAD));
      keywords.add(new Keyword(null, null, null, "cheap cruise", KeywordMatchType.PHRASE));
      keywords.add(new Keyword(null, null, null, "cruise", KeywordMatchType.EXACT));

      // Create a keyword estimate request for each keyword.
      List<KeywordEstimateRequest> keywordEstimateRequests =
          new ArrayList<KeywordEstimateRequest>();
      for (Keyword keyword : keywords) {
        KeywordEstimateRequest keywordEstimateRequest = new KeywordEstimateRequest();
        keywordEstimateRequest.setKeyword(keyword);
        keywordEstimateRequests.add(keywordEstimateRequest);
      }

      // Add a negative keyword to the traffic estimate.
      KeywordEstimateRequest negativeKeywordEstimateRequest = new KeywordEstimateRequest();
      negativeKeywordEstimateRequest.setKeyword(new Keyword(null, null, null, "hiking tour",
          KeywordMatchType.BROAD));
      negativeKeywordEstimateRequest.setIsNegative(true);
      keywordEstimateRequests.add(negativeKeywordEstimateRequest);

      // Create ad group estimate requests.
      List<AdGroupEstimateRequest> adGroupEstimateRequests =
          new ArrayList<AdGroupEstimateRequest>();
      AdGroupEstimateRequest adGroupEstimateRequest = new AdGroupEstimateRequest();
      adGroupEstimateRequest.setKeywordEstimateRequests(
          keywordEstimateRequests.toArray(new KeywordEstimateRequest[]{}));
      adGroupEstimateRequest.setMaxCpc(new Money(null, 1000000L));
      adGroupEstimateRequests.add(adGroupEstimateRequest);

      // Create campaign estimate requests.
      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);

      // Create selector.
      TrafficEstimatorSelector selector = new TrafficEstimatorSelector();
      selector.setCampaignEstimateRequests(
          campaignEstimateRequests.toArray(new CampaignEstimateRequest[]{}));

      // Get traffic estimates.
      TrafficEstimatorResult result = trafficEstimatorService.get(selector);

      // Display traffic estimates.
      if (result != null && result.getCampaignEstimates() != null) {
        KeywordEstimate[] keywordEstimates =
            result.getCampaignEstimates()[0].getAdGroupEstimates()[0].getKeywordEstimates();
View Full Code Here

TOP

Related Classes of com.google.api.adwords.v201309.cm.AdGroupAdPage

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.