specifying the CPC currency for GenerateKeywordHistoricalMetricsRequest

64 views
Skip to first unread message

Alex Gunner

unread,
Feb 28, 2024, 7:46:58 AM2/28/24
to Google Ads API and AdWords API Forum
Hi,

I'm using the V15 / v29 Google Ads API Client Library for Java and running this sample to get a CPC figure for a keyword I'm interested in: 

HistoricalMetricsOptions options = HistoricalMetricsOptions.newBuilder().setIncludeAverageCpc(true).build();


GenerateKeywordHistoricalMetricsRequest request = GenerateKeywordHistoricalMetricsRequest.newBuilder()

.setCustomerId(String.valueOf(customerId))

.addAllKeywords(Arrays.asList("tennis racquets"))

.addGeoTargetConstants(ResourceNames.geoTargetConstant(2036)) // australia

.setKeywordPlanNetwork(KeywordPlanNetwork.GOOGLE_SEARCH)

.setHistoricalMetricsOptions(options)

.build();


try (KeywordPlanIdeaServiceClient keywordPlanIdeaServiceClient = googleAdsClient.getLatestVersion().createKeywordPlanIdeaServiceClient())

{

GenerateKeywordHistoricalMetricsResponse response = keywordPlanIdeaServiceClient.generateKeywordHistoricalMetrics(request);

for (GenerateKeywordHistoricalMetricsResult result : response.getResultsList())

{

KeywordPlanHistoricalMetrics metrics = result.getKeywordMetrics();


System.out.println("cpc: " + metrics.getAverageCpcMicros() / 1000000f);


What currency do the results use?


How do I specify I want the CPC value to be expressed in USD or AUD?


Thank you.

Google Ads API Forum Advisor

unread,
Feb 28, 2024, 1:28:25 PM2/28/24
to sli...@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for contacting the Google Ads API support team.

After reviewing your concern, I understand that your issue is that you don't know the currency used for the CPC value returned by the Google Ads API and how to specify a desired currency, like USD or AUD. Please note that the average_cpc_micros field in the GenerateKeywordHistoricalMetricsResponse does not explicitly hold the currency information. The Google Ads API v15 documentation does not specify the default currency used for historical metrics, and it could potentially vary depending on your account settings or geographical targeting. I would recommend referring to the Help Center article for more information about currencies settings. Additionally, You can use the Google Ads user interface to retrieve historical keyword metrics and filter them by your desired currency.

If you need any further clarification or assistance, feel free to reach out.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02rzWFy:ref"

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages