N-Gram / Search Query Mining Tool script stopped working

474 views
Skip to first unread message

Bart Hoogland

unread,
May 21, 2021, 4:01:01 AM5/21/21
to Google Ads Scripts Forum
Hi,

There's a script I've been using quite often to monitor search queries in my campaigns. This is the Brainlabs' Search Query Mining Tool script. Unfortunately it has stopped working for me since a week or so. 

It runs fine, but after only 5 seconds it gives me following message in the log: "Could not find any campaigns with impressions and the specified options.", even though we have plenty of campaigns running in the account I'm running the script from. 

I've looked into the script and this message is shown if the variable activeCampaignIds is equal to 0. But this shouldn't be the case, since we do have running campaigns.

Hopefully someone can help me out!

Thanks in advance.

Best regards,

Bart

kris boorman

unread,
May 21, 2021, 5:09:16 AM5/21/21
to Google Ads Scripts Forum
Its stopped working for me too. I've seen on twitter that brainlabs have been made aware of it. 

Google Ads Scripts Forum Advisor

unread,
May 21, 2021, 6:22:58 AM5/21/21
to adwords...@googlegroups.com
Hi Bart,

Thanks for raising this to us. Can you kindly provide your CID and script so I can check this on our end? You may send them here or privately via the reply to author option. If this option is not available at your end, you may send it through our email (googleadsscr...@google.com) instead.

However, since this is a script created by the third party Brainlabs, maybe it is best that you reach out to their team as I would not be able to provide insights on this right away. Nevertheless, I'll still happily assist you and investigate what is causing the issue.

Looking forward to your reply.

Thanks,
Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2HCdS8:ref

Bart Hoogland

unread,
May 21, 2021, 7:34:13 AM5/21/21
to Google Ads Scripts Forum
Thanks Henry, I've sent an e-mail.

Op vrijdag 21 mei 2021 om 12:22:58 UTC+2 schreef adsscriptsforumadvisor:

Google Ads Scripts Forum Advisor

unread,
May 24, 2021, 3:27:58 AM5/24/21
to adwords...@googlegroups.com
Hello Bart,

Thanks for providing the requested details. I have debugged the script and found out that the issue seems be with the report query itself around line 99 where the campaignNameContains is set to empty. When you set a WHERE clause to compare with an empty variable, it won't be just ignored. The report query will run with the conditions you set. You can test the issue out on your end by copying lines 99-110 into a new script. Declare the variables campaignNameContains, whereStatements, and activeCampaignIds, then remove the WHERE clause and replace "AND" with "WHERE". It will log the same message if it did not capture any campaigns and you may add an else statement to see it if captured campaigns.

With the way that the script was coded, I would suggest that you remove line 102 and write another if statement before line 90 that would look like below code. This will check if you have set anything in the campaignNameContains variable (line 27), otherwise the report query will not work as intended.
  
  if (campaignNameContains != "") {
    whereStatements += "AND CampaignName CONTAINS_IGNORE_CASE '" + campaignNameContains + "' ";
  }
Let me know how it goes or if you have questions.

Bart Hoogland

unread,
May 25, 2021, 3:15:30 AM5/25/21
to Google Ads Scripts Forum
Perfect Harry, that worked (the only other small thing I had to change was "AND" into "WHERE" on line 103.

Cheers for the help!

Op maandag 24 mei 2021 om 09:27:58 UTC+2 schreef adsscriptsforumadvisor:

Ingram Leedy

unread,
May 27, 2021, 5:47:47 PM5/27/21
to Google Ads Scripts Forum
Could you post your edited/completed working script? Thanks!

Google Ads Scripts Forum Advisor

unread,
May 27, 2021, 11:29:38 PM5/27/21
to adwords...@googlegroups.com
Hello,

Harry here. I've attached the updated version of the script for your reference. Kindly take note to update the dates and the spreadsheet URL. Let me know how it goes after trying.
script.txt

Ingram Leedy

unread,
May 28, 2021, 10:57:24 AM5/28/21
to Google Ads Scripts Forum
Thank you!! Just tested and works perfectly!
Reply all
Reply to author
Forward
0 new messages