(Google Ads API - JAVA) research of Keywords

100 views
Skip to first unread message

javav...@gmail.com

unread,
Mar 12, 2019, 1:54:53 PM3/12/19
to AdWords API and Google Ads API Forum
Hello To Everybody :)

I Have a question regards extracting information on Keywords. i need to get Search volume ( at the beginning )  during specific time using Google Ads API (JAVA). Can not find any example on how to do it. "GenerateKeywordIdeas" is providing ideas for keywords but i need info only on keywords i would  provide.

Thank you in advance:)

googleadsapi...@google.com

unread,
Mar 12, 2019, 3:48:29 PM3/12/19
to javav...@gmail.com, AdWords API and Google Ads API Forum
Hello,

You will want to use the KeywordPlanService to obtain the forecast of a keyword. Although we don't have this sample in Java, you can find it in both C# and PHP.

Let me know if you have any issues.

Regards,
Anthony
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@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+unsubscribe@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/fd6b7d59-5311-46df-9f83-a92c1ceadea9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

javav...@gmail.com

unread,
Mar 15, 2019, 9:43:04 AM3/15/19
to AdWords API and Google Ads API Forum
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


googleadsapi...@google.com

unread,
Mar 15, 2019, 3:31:38 PM3/15/19
to AdWords API and Google Ads API Forum
Hi, 

You would need to prepare the KeywordPlan which is structured as follows:  KeywordPlan > KeywordPlanCampaign > KeywordPlanAdGroup > KeywordPlanKeyword. You could check the release notes for more details. Please check the code snippet in Java for reference. Let me know if you face any issues while trying this.  

Thanks,
Sreelakshmi, Google Ads API Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@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+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
GenerateForecastMetrics.txt

javav...@gmail.com

unread,
Mar 16, 2019, 6:53:39 PM3/16/19
to AdWords API and Google Ads API Forum

Thank you for your email, code works well and i have one more question:

KeywordPlanKeywordForecast object provides estimated data, but does not have keyword name or search query like KeywordPlanKeywordHistoricalMetrics has. how to know the keyword name  of data extracted, when more than one keyword is loaded.

Thank you
Gintaras


googleadsapi...@google.com

unread,
Mar 18, 2019, 2:38:42 PM3/18/19
to AdWords API and Google Ads API Forum
Hi Gintaras, 

You can use the GoogleAdsService to get the text from keyword_plan_keyword resource for the corresponding keyword_plan_ad_group_keyword created in the plan. The query given below should be helpful. 

SELECT
keyword_plan_keyword.text,
FROM
keyword_plan_keyword
WHERE
keyword_plan_keyword.id IN (14140579338)
LIMIT
100

Please let me know if you have any additional questions. 

Thanks,
Sreelakshmi, Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@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+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
Reply all
Reply to author
Forward
0 new messages