How to get relevant search terms based on search keywords

73 views
Skip to first unread message

Elumalai Eswar Prasad

unread,
Jan 29, 2025, 1:12:29 AM1/29/25
to Google Ads API and AdWords API Forum
Hi,

{
  "query": "SELECT search_term_view.search_term, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions, metrics.interactions, segments.date, segments.keyword.info.text FROM search_term_view WHERE ad_group.id = ##### AND campaign.id = ##### AND search_term_view.status != 'EXCLUDED' AND metrics.impressions > 1 AND metrics.clicks > 1 AND segments.date BETWEEN '2024-11-01' AND '2024-11-30' AND segments.keyword.info.text LIKE '%best video creator%'"
}

I am getting search terms when i am running this query from the search_terms.
https://developers.google.com/google-ads/api/rest/reference/rest/v18/customers.googleAds/search

But how can i search multiple keywords similar to like image attached below

Screenshot 2025-01-29 104728.png

Thanks in advance

Google Ads API Forum Advisor

unread,
Jan 29, 2025, 5:07:46 AM1/29/25
to eswar....@gmail.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

To fetch the search term based on multiple keywords, you may try the below query:
SELECT search_term_view.search_term, metrics.impressions, metrics.clicks, metrics.cost_micros, metrics.conversions, metrics.interactions, segments.date, segments.keyword.info.text FROM search_term_view WHERE ad_group.id = ##### AND campaign.id = ##### AND search_term_view.status != 'EXCLUDED' AND metrics.impressions > 1 AND metrics.clicks > 1 AND segments.date BETWEEN '2024-11-01' AND '2024-11-30' AND segments.keyword.info.text IN ('keyword 1', 'keyword 2')
Additionally, you can utilize the Query Builder and Query Validator to build and validate your queries. To retrieve Google Ads API entities and reporting data, you can use one of these methods like GoogleAdsService.SearchStream or GoogleAdsService.Search

If you face any issue while retrieving the above data for the above query, please share the complete API logs (request and response with request-id and request header) generated at your end.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02vGyup:ref" (ADR-00286240)

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5



Elumalai Eswar Prasad

unread,
Jan 29, 2025, 5:32:59 AM1/29/25
to Google Ads API and AdWords API Forum
 I read somewhere using IN results in exact match of the keyword and if I segments.keyword.info.text LIKE '%best video creator% like this, i can get contains result of this keyword. Can you suggest how can i get the "Contains" result. My goal here is to get the potential search terms which can be used as search keywords. To filter the search terms i want to search with added search keywords so that i can take the necessary results.

Google Ads API Forum Advisor

unread,
Jan 29, 2025, 8:41:06 AM1/29/25
to eswar....@gmail.com, adwor...@googlegroups.com

Hi,

With regard to your concern, we are checking with the rest of our team and one of our colleagues will reach out to you once we have an update.

Google Ads API Forum Advisor

unread,
Jan 29, 2025, 9:23:36 AM1/29/25
to eswar....@gmail.com, adwor...@googlegroups.com
Hello,

To clarify, the LIKE clause is working for a single value as you expect, and the IN clause would work if you wanted exact match, but you want to match a substring instead?

So for example, you would want to match all keywords that are LIKE "%keyword1%" OR LIKE "%keyword2%", correct?

If that's the case, I may have a solution, but it's a little complex. The API doesn't support OR operators in WHERE clauses, only AND. However, it does support the REGEXP_MATCH, so you could craft a regular expression. So instead of using field LIKE "%keyword1%", you would use field REGEXP_MATCH ".*keyword1.*".

You can then chain together different conditions in the regular expression using the "|" operator, so the final condition would be: field REGEXP_MATCH ".*keyword1.*|.*keyword2.*"

Note that the ".*" before and after each keyword is required, because REGEXP_MATCH attempts to match against the entire string. You can chain more of these together, but beware that the more complicated the regular expression, the worse the performance of the query may get.

This message is in relation to case "ref:!00D1U01174p.!5004Q02vGyup:ref" (ADR-00286240)

Thanks,
 
Google Logo
Michael Cloonan
Google Ads API Team


Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
 

 



Reply all
Reply to author
Forward
0 new messages