Package com.google.api.adwords.v201309.o

Examples of com.google.api.adwords.v201309.o.TargetingIdeaSelector


   */
  public void testGetRelatedToKeywordSearchParameterAllPages() throws Exception {
    int index = 0;

    // Create selector and parameters.
    TargetingIdeaSelector selector = new TargetingIdeaSelector();

    RelatedToKeywordSearchParameter relatedToKeywordSearchParameter =
        new RelatedToKeywordSearchParameter();
    Keyword keyword = new Keyword();
    keyword.setText("flowers");
    keyword.setMatchType(KeywordMatchType.BROAD);
    relatedToKeywordSearchParameter.setKeywords(new Keyword[] {keyword});

    selector.setSearchParameters(new SearchParameter[] {relatedToKeywordSearchParameter});

    selector.setIdeaType(IdeaType.KEYWORD);
    selector.setRequestType(RequestType.IDEAS);

    Paging paging = new Paging(index, 100);
    selector.setPaging(paging);

    TargetingIdeaPage page = service.get(selector);
    ArrayList<TargetingIdea> result = new ArrayList<TargetingIdea>();

    while (paging.getStartIndex() + 100 <= page.getTotalNumEntries()) {
      assertNotNull(page);
      result.addAll(Arrays.asList(page.getEntries()));
      paging.setStartIndex(paging.getStartIndex() + 100);
      selector.setPaging(paging);
      page = service.get(selector);
    }
    assertEquals(page.getTotalNumEntries(), new Integer(result.size()));
  }
View Full Code Here


  /**
   * Test whether we can request related to url search parameter.
   */
  public void testGetRelatedToUrlSearchParameter() throws Exception {
    // Create selector and parameters.
    TargetingIdeaSelector selector = new TargetingIdeaSelector();

    RelatedToUrlSearchParameter relatedToUrlSearchParameter =
        new RelatedToUrlSearchParameter();
    relatedToUrlSearchParameter.setUrls(new String[] {"http://finance.google.com"});

    selector.setSearchParameters(new SearchParameter[] {relatedToUrlSearchParameter});
    selector.setIdeaType(IdeaType.PLACEMENT);
    selector.setRequestType(RequestType.IDEAS);

    Paging paging = new Paging(0, 1);
    selector.setPaging(paging);

    TargetingIdeaPage page = service.get(selector);
  }
View Full Code Here

  /**
   * Test whether we can request seed ad group id saerch parameter.
   */
  public void testGetSeedAdGroupIdSearchParameter() throws Exception {
    // Create selector and parameters.
    TargetingIdeaSelector selector = new TargetingIdeaSelector();

    SeedAdGroupIdSearchParameter seedAdGroupIdSearchParameter =
        new SeedAdGroupIdSearchParameter(null, adGroupId);

    selector.setSearchParameters(new SearchParameter[] {seedAdGroupIdSearchParameter});
    selector.setIdeaType(IdeaType.KEYWORD);
    selector.setRequestType(RequestType.IDEAS);

    Paging paging = new Paging(0, 1);
    selector.setPaging(paging);

    TargetingIdeaPage page = service.get(selector);
  }
View Full Code Here

  /**
   * Test whether we can request bulk keyword ideas.
   */
  public void testGetBulkKeywordIdeas() throws Exception {
    // Create selector and parameters.
    TargetingIdeaSelector selector = new TargetingIdeaSelector();

    RelatedToKeywordSearchParameter relatedToKeywordSearchParameter =
        new RelatedToKeywordSearchParameter();
    Keyword keyword = new Keyword();
    keyword.setText("presidential vote");
    keyword.setMatchType(KeywordMatchType.EXACT);
    relatedToKeywordSearchParameter.setKeywords(new Keyword[] {keyword});

    RelatedToUrlSearchParameter relatedToUrlSearchParameter =
        new RelatedToUrlSearchParameter();
    relatedToUrlSearchParameter.setUrls(new String[] {"http://finance.google.com"});

    selector.setSearchParameters(new SearchParameter[] {
      relatedToKeywordSearchParameter, relatedToUrlSearchParameter});

    selector.setIdeaType(IdeaType.KEYWORD);
    selector.setRequestType(RequestType.IDEAS);

    Paging paging = new Paging(0, 1);
    selector.setPaging(paging);

    TargetingIdeaPage page = service.get(selector);
  }
View Full Code Here

      // Get the TargetingIdeaService.
      TargetingIdeaServiceInterface targetingIdeaService =
          user.getService(AdWordsService.V201306.TARGETING_IDEA_SERVICE);

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

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

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

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

      // Create seed URL.
      String url = "mars.google.com";

      // Create selector.
      TargetingIdeaSelector selector = new TargetingIdeaSelector();
      selector.setRequestType(RequestType.IDEAS);
      selector.setIdeaType(IdeaType.PLACEMENT);
      selector.setRequestedAttributeTypes(new AttributeType[] {AttributeType.CRITERION,
          AttributeType.PLACEMENT_TYPE});

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

      // Create related to URL search parameter.
      RelatedToUrlSearchParameter relatedToUrlSearchParameter = new RelatedToUrlSearchParameter();
      relatedToUrlSearchParameter.setUrls(new String[] {url});
      relatedToUrlSearchParameter.setIncludeSubUrls(false);
      selector.setSearchParameters(new SearchParameter[] {relatedToUrlSearchParameter});

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

      // Display related placements.
View Full Code Here

      Predicate adGroupIdPredicate =
          new Predicate("AdGroupId", PredicateOperator.IN, new String[] {adGroupId.toString()});
      selector.setPredicates(new Predicate[] {adGroupIdPredicate});

      // Get bid landscape for ad group criteria.
      AdGroupBidLandscapePage page = dataService.getAdGroupBidLandscape(selector);

      // Display bid landscapes.
      if (page.getEntries() != null) {
        for (AdGroupBidLandscape adGroupBidLandscape : page.getEntries()) {
          System.out.println("Ad group bid landscape with ad group id \""
              + adGroupBidLandscape.getAdGroupId() + "\", type \""
              + adGroupBidLandscape.getType() + "\", current \""
              + adGroupBidLandscape.getLandscapeCurrent() + "\", start date \""
              + adGroupBidLandscape.getStartDate() + "\", end date \""
View Full Code Here

      String query = String.format(
          "SELECT Id, AdGroupId, Status WHERE AdGroupId = %d AND Status = ACTIVE ORDER BY Id ",
          adGroupId);

      // Get all active ad group criteria.
      AdGroupCriterionPage page = adGroupCriterionService.query(query);

      // Display ad group criteria.
      if (page.getEntries() != null && page.getEntries().length > 0) {
        for (AdGroupCriterion adGroupCriterion : page.getEntries()) {
          if (adGroupCriterion instanceof BiddableAdGroupCriterion) {
            BiddableAdGroupCriterion biddableAdGroupCriterion =
                (BiddableAdGroupCriterion) adGroupCriterion;
            System.out.println("Ad group criterion with ad group id \""
                + biddableAdGroupCriterion.getAdGroupId() + "\", criterion id \""
View Full Code Here

      Predicate adGroupIdPredicate =
          new Predicate("AdGroupId", PredicateOperator.IN, new String[] {adGroupId.toString()});
      selector.setPredicates(new Predicate[] {statusPredicate, adGroupIdPredicate});

      // Get all active ad group criteria.
      AdGroupCriterionPage page = adGroupCriterionService.get(selector);

      // Display ad group criteria.
      if (page.getEntries() != null && page.getEntries().length > 0) {
        for (AdGroupCriterion adGroupCriterion : page.getEntries()) {
          if (adGroupCriterion instanceof BiddableAdGroupCriterion) {
            BiddableAdGroupCriterion biddableAdGroupCriterion =
                (BiddableAdGroupCriterion) adGroupCriterion;
            System.out.println("Ad group criterion with ad group id \""
                + biddableAdGroupCriterion.getAdGroupId() + "\", criterion id \""
View Full Code Here

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

      // Get the AdGroupCriterionService.
      AdGroupCriterionServiceInterface adGroupCriterionService =
          user.getService(AdWordsService.V201309.ADGROUP_CRITERION_SERVICE);

      Long adGroupId = Long.parseLong("INSERT_AD_GROUP_ID_HERE");

      String query = String.format(
          "SELECT Id, AdGroupId, Status WHERE AdGroupId = %d AND Status = ACTIVE ORDER BY Id ",
          adGroupId);

      // Get all active ad group criteria.
      AdGroupCriterionPage page = adGroupCriterionService.query(query);

      // Display ad group criteria.
      if (page.getEntries() != null && page.getEntries().length > 0) {
        for (AdGroupCriterion adGroupCriterion : page.getEntries()) {
          if (adGroupCriterion instanceof BiddableAdGroupCriterion) {
View Full Code Here

TOP

Related Classes of com.google.api.adwords.v201309.o.TargetingIdeaSelector

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.