Package com.google.api.ads.adwords.axis.v201306.o

Examples of com.google.api.ads.adwords.axis.v201306.o.StringAttribute


    // Get the TargetingIdeaService.
    TargetingIdeaServiceInterface targetingIdeaService =
        adWordsServices.get(session, TargetingIdeaServiceInterface.class);

    // Create selector.
    TargetingIdeaSelector selector = new TargetingIdeaSelector();
    selector.setRequestType(RequestType.IDEAS);
    selector.setIdeaType(IdeaType.KEYWORD);
    selector.setRequestedAttributeTypes(new AttributeType[] {
        AttributeType.KEYWORD_TEXT,
        AttributeType.SEARCH_VOLUME,
        AttributeType.CATEGORY_PRODUCTS_AND_SERVICES});

    // Set selector paging (required for targeting idea service).
    Paging paging = new Paging();
    paging.setStartIndex(0);
    paging.setNumberResults(10);
    selector.setPaging(paging);

    // Create related to query search parameter.
    RelatedToQuerySearchParameter relatedToQuerySearchParameter =
        new RelatedToQuerySearchParameter();
    relatedToQuerySearchParameter.setQueries(new String[] {"mars cruise"});

    // Language setting (optional).
    // The ID can be found in the documentation:
    //   https://developers.google.com/adwords/api/docs/appendix/languagecodes
    // Note: As of v201302, only a single language parameter is allowed.
    LanguageSearchParameter languageParameter = new LanguageSearchParameter();
    Language english = new Language();
    english.setId(1000L);
    languageParameter.setLanguages(new Language[] {english});

    selector.setSearchParameters(
        new SearchParameter[] {relatedToQuerySearchParameter, languageParameter});

    // Get related keywords.
    TargetingIdeaPage page = targetingIdeaService.get(selector);
View Full Code Here


  }

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session) throws Exception {
    // Get the TargetingIdeaService.
    TargetingIdeaServiceInterface targetingIdeaService =
        adWordsServices.get(session, TargetingIdeaServiceInterface.class);

    // Create selector.
    TargetingIdeaSelector selector = new TargetingIdeaSelector();
    selector.setRequestType(RequestType.IDEAS);
    selector.setIdeaType(IdeaType.KEYWORD);
    selector.setRequestedAttributeTypes(new AttributeType[] {
        AttributeType.KEYWORD_TEXT,
        AttributeType.SEARCH_VOLUME,
        AttributeType.CATEGORY_PRODUCTS_AND_SERVICES});

    // Set selector paging (required for targeting idea service).
    Paging paging = new Paging();
    paging.setStartIndex(0);
    paging.setNumberResults(10);
    selector.setPaging(paging);

    // Create related to query search parameter.
    RelatedToQuerySearchParameter relatedToQuerySearchParameter =
        new RelatedToQuerySearchParameter();
    relatedToQuerySearchParameter.setQueries(new String[] {"mars cruise"});

    // Language setting (optional).
    // The ID can be found in the documentation:
    //   https://developers.google.com/adwords/api/docs/appendix/languagecodes
    // Note: As of v201302, only a single language parameter is allowed.
    LanguageSearchParameter languageParameter = new LanguageSearchParameter();
    Language english = new Language();
    english.setId(1000L);
    languageParameter.setLanguages(new Language[] {english});

    selector.setSearchParameters(
        new SearchParameter[] {relatedToQuerySearchParameter, languageParameter});

    // Get related keywords.
    TargetingIdeaPage page = targetingIdeaService.get(selector);

    // Display related keywords.
    if (page.getEntries() != null && page.getEntries().length > 0) {
      for (TargetingIdea targetingIdea : page.getEntries()) {
        Map<AttributeType, Attribute> data = Maps.toMap(targetingIdea.getData());
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

  }

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session) throws Exception {
    // Get the TrafficEstimatorService.
    TrafficEstimatorServiceInterface trafficEstimatorService =
        adWordsServices.get(session, TrafficEstimatorServiceInterface.class);

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

    // Display related keywords.
    if (page.getEntries() != null && page.getEntries().length > 0) {
      for (TargetingIdea targetingIdea : page.getEntries()) {
        Map<AttributeType, Attribute> data = Maps.toMap(targetingIdea.getData());
        StringAttribute keyword = (StringAttribute) data.get(AttributeType.KEYWORD_TEXT);

        IntegerSetAttribute categories =
            (IntegerSetAttribute) data.get(AttributeType.CATEGORY_PRODUCTS_AND_SERVICES);
        String categoriesString = "(none)";
        if (categories != null && categories.getValue() != null) {
          categoriesString = Joiner.on(", ").join(Ints.asList(categories.getValue()));
        }
        Long averageMonthlySearches =
            ((LongAttribute) data.get(AttributeType.SEARCH_VOLUME))
                .getValue();
        System.out.println("Keyword with text '" + keyword.getValue()
            + "', and average monthly search volume '" + averageMonthlySearches
            + "' was found with categories: " + categoriesString);
      }
    } else {
      System.out.println("No related keywords were found.");
View Full Code Here

    // Display related keywords.
    if (page.getEntries() != null && page.getEntries().length > 0) {
      for (TargetingIdea targetingIdea : page.getEntries()) {
        Map<AttributeType, Attribute> data = Maps.toMap(targetingIdea.getData());
        StringAttribute keyword = (StringAttribute) data.get(AttributeType.KEYWORD_TEXT);

        IntegerSetAttribute categories =
            (IntegerSetAttribute) data.get(AttributeType.CATEGORY_PRODUCTS_AND_SERVICES);
        String categoriesString = "(none)";
        if (categories != null && categories.getValue() != null) {
          categoriesString = Joiner.on(", ").join(Ints.asList(categories.getValue()));
        }
        Long averageMonthlySearches =
            ((LongAttribute) data.get(AttributeType.SEARCH_VOLUME))
                .getValue();
        System.out.println("Keyword with text '" + keyword.getValue()
            + "', and average monthly search volume '" + averageMonthlySearches
            + "' was found with categories: " + categoriesString);
      }
    } else {
      System.out.println("No related keywords were found.");
View Full Code Here

    // Display related keywords.
    if (page.getEntries() != null && page.getEntries().length > 0) {
      for (TargetingIdea targetingIdea : page.getEntries()) {
        Map<AttributeType, Attribute> data = Maps.toMap(targetingIdea.getData());
        StringAttribute keyword = (StringAttribute) data.get(AttributeType.KEYWORD_TEXT);

        IntegerSetAttribute categories =
            (IntegerSetAttribute) data.get(AttributeType.CATEGORY_PRODUCTS_AND_SERVICES);
        String categoriesString = "(none)";
        if (categories != null && categories.getValue() != null) {
          categoriesString = Joiner.on(", ").join(Ints.asList(categories.getValue()));
        }
        Long averageMonthlySearches =
            ((LongAttribute) data.get(AttributeType.SEARCH_VOLUME))
                .getValue();
        System.out.println("Keyword with text '" + keyword.getValue()
            + "', and average monthly search volume '" + averageMonthlySearches
            + "' was found with categories: " + categoriesString);
      }
    } else {
      System.out.println("No related keywords were found.");
View Full Code Here

      // Display related keywords.
      if (page.getEntries() != null && page.getEntries().length > 0) {
        for (TargetingIdea targetingIdea : page.getEntries()) {
          Map<AttributeType, Attribute> data = MapUtils.toMap(targetingIdea.getData());
          StringAttribute keyword = (StringAttribute) data.get(AttributeType.KEYWORD_TEXT);
          IntegerSetAttribute categories =
              (IntegerSetAttribute) data.get(AttributeType.CATEGORY_PRODUCTS_AND_SERVICES);
          String categoriesString = "(none)";
          if (categories != null && categories.getValue() != null) {
            categoriesString = StringUtils.join(ArrayUtils.toObject(categories.getValue()), ", ");
          }
          Long averageMonthlySearches =
              ((LongAttribute) data.get(AttributeType.SEARCH_VOLUME))
                  .getValue();
          System.out.println("Keyword with text '" + keyword.getValue() +
              "' and average monthly search volume '"
              + averageMonthlySearches + "' was found with categories: " + categoriesString);
        }
      } else {
        System.out.println("No related keywords were found.");
View Full Code Here

      // Display related keywords.
      if (page.getEntries() != null && page.getEntries().length > 0) {
        for (TargetingIdea targetingIdea : page.getEntries()) {
          Map<AttributeType, Attribute> data = MapUtils.toMap(targetingIdea.getData());
          StringAttribute keyword = (StringAttribute) data.get(AttributeType.KEYWORD_TEXT);
          IntegerSetAttribute categories =
              (IntegerSetAttribute) data.get(AttributeType.CATEGORY_PRODUCTS_AND_SERVICES);
          String categoriesString = "(none)";
          if (categories != null && categories.getValue() != null) {
            categoriesString = StringUtils.join(ArrayUtils.toObject(categories.getValue()), ", ");
          }
          Long averageMonthlySearches =
              ((LongAttribute) data.get(AttributeType.SEARCH_VOLUME))
                  .getValue();
          System.out.println("Keyword with text '" + keyword.getValue() +
              "' and average monthly search volume '"
              + averageMonthlySearches + "' was found with categories: " + categoriesString);
        }
      } else {
        System.out.println("No related keywords were found.");
View Full Code Here

TOP

Related Classes of com.google.api.ads.adwords.axis.v201306.o.StringAttribute

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.