Hello Anthony,
 I have  been replicating C# code with java and been playing with object 
*KeywordPlanServiceClient 
*where successfully manage to get *KeywordPlan *required to run 
*ForecastMetrics 
*( expect this object to provide required info)


// Here is how to create Object:  
*KeywordPlan *

  private String CreateKeywordPlan(GoogleAdsClient googleAdsClient, long 
customerId) {

        // get KeywordPlanService
        KeywordPlanServiceClient serviceClient = 
googleAdsClient.getLatestVersion().createKeywordPlanServiceClient();

        //Create a keyword plan for next quarter forecast
        KeywordPlan keywordPlan = KeywordPlan.newBuilder()
                .setName(StringValue.newBuilder().setValue("Keyword plan 
for trafic estimate #" + System.currentTimeMillis()))
                
.setForecastPeriod(KeywordPlanForecastPeriod.newBuilder().setDateInterval(KeywordPlanForecastInterval.NEXT_QUARTER).build())
                .build();

        KeywordPlanOperation operation = 
KeywordPlanOperation.newBuilder().setCreate(keywordPlan).build();
        List<KeywordPlanOperation> operations = new ArrayList<>();
        operations.add(operation);

        // Add the keyword plan
        MutateKeywordPlansResponse response = 
serviceClient.mutateKeywordPlans(String.valueOf(customerId), operations);

        // Display the results
        String keywordPlanResource= 
response.getResults(0).getResourceName();
        System.out.println("Create Keyword plan: " + keywordPlanResource);

        return keywordPlanResource;
    }



// Here is how to create keywords Objects:  *ForecastMetrics* 

 private void GenerateForecastMetrics(GoogleAdsClient googleAdsClient, 
String keywordPlanResource) {
        KeywordPlanServiceClient kpServiceClient = 
googleAdsClient.getLatestVersion().createKeywordPlanServiceClient();
        GenerateForecastMetricsResponse response = 
kpServiceClient.generateForecastMetrics(keywordPlanResource);
        for (KeywordPlanKeywordForecast keywordPlanKeywordForecast : 
response.getKeywordForecastsList()) {
            ForecastMetrics metrics = 
keywordPlanKeywordForecast.getKeywordForecast();
            System.out.println(" Keyword ID: " + 
keywordPlanKeywordForecast.getKeywordPlanAdGroupKeyword());
            System.out.println(" Estimated daily clicks: " + 
metrics.getClicks());
            System.out.println(" Estimated daily impressions: " + 
metrics.getImpressions());
            System.out.println(" Estimated average cpc (micros): " + 
metrics.getCtr());
            System.out.println("----");
        }

    }


Problem i have that *KeywordPlan *does not hold Keywords and i do not know 
how to link it. Object wish holds keywords looks like *KeywordPlanKeyword*, 
how to import/add/assign it to the *KeywordPlan *

please let me know what objects needs to be created  and how they are 
linking (*Pseudo-code*) to get info on keywords. Maybe there is a option to 
avoid creating keyword plan and load list of keywords ?

Best Regards
Gintaras


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/a4d83666-368e-483f-afa4-0b86756cf158%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • (Google... javavilnius
    • RE... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
      • ... javavilnius
        • ... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
          • ... javavilnius
            • ... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum

Reply via email to