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

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


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

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session, String[] locationNames)
      throws Exception {
    // Get the LocationCriterionService.
    LocationCriterionServiceInterface locationCriterionService =
        adWordsServices.get(session, LocationCriterionServiceInterface.class);

    Selector selector = new Selector();
    selector.setFields(new String[] {"Id", "LocationName", "CanonicalName", "DisplayType",
        "ParentLocations", "Reach", "TargetingStatus"});

    selector.setPredicates(new Predicate[] {
        // Location names must match exactly, only EQUALS and IN are
        // supported.
        new Predicate("LocationName", PredicateOperator.IN, locationNames),
        // Set the locale of the returned location names.
        new Predicate("Locale", PredicateOperator.EQUALS, new String[] {"en"})});

    // Make the get request.
    LocationCriterion[] locationCriteria = locationCriterionService.get(selector);

    // Display the resulting location criteria.
    for (LocationCriterion locationCriterion : locationCriteria) {
      String parentString =
          getParentLocationString(locationCriterion.getLocation().getParentLocations());
View Full Code Here

    campaign.setStatus(CampaignStatus.PAUSED);
    BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration();
    biddingStrategyConfiguration.setBiddingStrategyType(BiddingStrategyType.MANUAL_CPC);

    // You can optionally provide a bidding scheme in place of the type.
    ManualCpcBiddingScheme cpcBiddingScheme = new ManualCpcBiddingScheme();
    cpcBiddingScheme.setEnhancedCpcEnabled(false);
    biddingStrategyConfiguration.setBiddingScheme(cpcBiddingScheme);

    campaign.setBiddingStrategyConfiguration(biddingStrategyConfiguration);

    // You can optionally provide these field(s).
View Full Code Here

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

        adWordsServices.get(session, BudgetServiceInterface.class);

    // Create a budget, which can be shared by multiple campaigns.
    Budget sharedBudget = new Budget();
    sharedBudget.setName("Interplanetary Cruise #" + System.currentTimeMillis());
    Money budgetAmount = new Money();
    budgetAmount.setMicroAmount(50000000L);
    sharedBudget.setAmount(budgetAmount);
    sharedBudget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD);
    sharedBudget.setPeriod(BudgetBudgetPeriod.DAILY);

    BudgetOperation budgetOperation = new BudgetOperation();
View Full Code Here

  }

  public static void runExample(
      AdWordsServices adWordsServices, AdWordsSession session, Long adGroupId) throws Exception {
    // Get the MutateJobService.
    MutateJobServiceInterface mutateJobService =
        adWordsServices.get(session, MutateJobServiceInterface.class);

    Random r = new Random();
    List<AdGroupCriterionOperation> operations = new ArrayList<AdGroupCriterionOperation>();

    // Create AdGroupCriterionOperations to add keywords.
    for (int i = 0; i < KEYWORD_NUMBER; i++) {
      // Create Keyword.
      String text = String.format("mars%d", i);

      // Make 10% of keywords invalid to demonstrate error handling.
      if (r.nextInt() % 10 == 0) {
        text = text + "!!!";
      }
      Keyword keyword = new Keyword();
      keyword.setText(text);
      keyword.setMatchType(KeywordMatchType.BROAD);

      // Create BiddableAdGroupCriterion.
      BiddableAdGroupCriterion bagc = new BiddableAdGroupCriterion();
      bagc.setAdGroupId(adGroupId);
      bagc.setCriterion(keyword);

      // Create AdGroupCriterionOperation.
      AdGroupCriterionOperation agco = new AdGroupCriterionOperation();
      agco.setOperand(bagc);
      agco.setOperator(Operator.ADD);

      // Add to list.
      operations.add(agco);
    }

    // You can specify up to 3 job IDs that must successfully complete before
    // this job can be processed.
    BulkMutateJobPolicy policy = new BulkMutateJobPolicy();
    policy.setPrerequisiteJobIds(new long[] {});

    // Call mutate to create a new job.
    SimpleMutateJob response =
        mutateJobService.mutate(operations.toArray(new Operation[operations.size()]), policy);

    long jobId = response.getId();
    System.out.printf("Job with ID %d was successfully created.\n", jobId);

    // Create selector to retrieve job status and wait for it to complete.
    BulkMutateJobSelector selector = new BulkMutateJobSelector();
    selector.setJobIds(new long[] {jobId});

    // Poll for job status until it's finished.
    System.out.println("Retrieving job status...");
    SimpleMutateJob jobStatusResponse = null;
    BasicJobStatus status = null;
    for (int i = 0; i < RETRIES_COUNT; i++) {
      Job[] jobs = mutateJobService.get(selector);
      jobStatusResponse = (SimpleMutateJob) jobs[0];
      status = jobStatusResponse.getStatus();
      if (status == BasicJobStatus.COMPLETED || status == BasicJobStatus.FAILED) {
        break;
      }
      System.out.printf("[%d] Current status is '%s', waiting %d seconds to retry...\n", i,
          status.toString(), RETRY_INTERVAL);
      Thread.sleep(RETRY_INTERVAL * 1000);
    }

    // Handle unsuccessful results.
    if (status == BasicJobStatus.FAILED) {
      throw new IllegalStateException("Job failed with reason: "
          + jobStatusResponse.getFailureReason());
    }
    if (status == BasicJobStatus.PENDING || status == BasicJobStatus.PROCESSING) {
      throw new IllegalAccessException("Job did not complete within "
          + ((RETRIES_COUNT - 1) * RETRY_INTERVAL) + " seconds.");
    }

    // Status must be COMPLETED.
    // Get the job result. Here we re-use the same selector.
    JobResult result = mutateJobService.getResult(selector);

    // Output results.
    int i = 0;
    for (Operand operand : result.getSimpleMutateResult().getResults()) {
      String outcome = operand.getPlaceHolder() == null ? "SUCCESS" : "FAILED";
View Full Code Here

    genderBiddableAdGroupCriterion.setCriterion(male);

    // https://developers.google.com/adwords/api/docs/appendix/ages
    AgeRange undetermined = new AgeRange();
    undetermined.setId(503999L);
    NegativeAdGroupCriterion ageRangeNegativeAdGroupCriterion = new NegativeAdGroupCriterion();
    ageRangeNegativeAdGroupCriterion.setAdGroupId(adGroupId);
    ageRangeNegativeAdGroupCriterion.setCriterion(undetermined);

    AdGroupCriterionOperation genderAdGroupCriterionOperation = new AdGroupCriterionOperation();
    genderAdGroupCriterionOperation.setOperand(genderBiddableAdGroupCriterion);
    genderAdGroupCriterionOperation.setOperator(Operator.ADD);
    AdGroupCriterionOperation ageRangeNegativeAdGroupCriterionOperation =
View Full Code Here

    Budget budget = new Budget();
    budget.setBudgetId(budgetId);
    campaign.setBudget(budget);

    // Set the campaign network options to Search and Search Network.
    NetworkSetting networkSetting = new NetworkSetting();
    networkSetting.setTargetGoogleSearch(true);
    networkSetting.setTargetSearchNetwork(true);
    networkSetting.setTargetContentNetwork(false);
    networkSetting.setTargetPartnerSearchNetwork(false);
    campaign.setNetworkSetting(networkSetting);

    // Set options that are not required.
    GeoTargetTypeSetting geoTarget = new GeoTargetTypeSetting();
    geoTarget.setPositiveGeoTargetType(GeoTargetTypeSettingPositiveGeoTargetType.DONT_CARE);
    KeywordMatchSetting keywordMatch = new KeywordMatchSetting();
    keywordMatch.setOptIn(Boolean.FALSE);
    campaign.setSettings(new Setting[] {geoTarget, keywordMatch});

    // You can create multiple campaigns in a single request.
    Campaign campaign2 = new Campaign();
    campaign2.setName("Interplanetary Cruise banner #" + System.currentTimeMillis());
    campaign2.setStatus(CampaignStatus.PAUSED);
    BiddingStrategyConfiguration biddingStrategyConfiguration2 = new BiddingStrategyConfiguration();
    biddingStrategyConfiguration2.setBiddingStrategyType(BiddingStrategyType.MANUAL_CPC);
    campaign2.setBiddingStrategyConfiguration(biddingStrategyConfiguration2);

    Budget budget2 = new Budget();
    budget2.setBudgetId(budgetId);
    campaign2.setBudget(budget2);

    NetworkSetting networkSetting2 = new NetworkSetting();
    networkSetting2.setTargetGoogleSearch(false);
    networkSetting2.setTargetSearchNetwork(false);
    networkSetting2.setTargetContentNetwork(true);
    networkSetting2.setTargetPartnerSearchNetwork(false);
    campaign2.setNetworkSetting(networkSetting2);

    KeywordMatchSetting keywordMatch2 = new KeywordMatchSetting();
    keywordMatch2.setOptIn(Boolean.FALSE);
    campaign2.setSettings(new Setting[] {keywordMatch2});
View Full Code Here

        adWordsServices.get(session, AdGroupAdServiceInterface.class);

    // Create selector.
    Selector selector = new Selector();
    selector.setFields(new String[] {"Id", "DisapprovalReasons"});
    selector.setOrdering(new OrderBy[] {new OrderBy("Id", SortOrder.ASCENDING)});

    // Create predicates.
    Predicate adGroupIdPredicate =
        new Predicate("AdGroupId", PredicateOperator.IN, new String[] {adGroupId.toString()});
    Predicate approvalStatusPredicate = new Predicate(
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.