Problem with setCpa after migration to New scripts experience

66 views
Skip to first unread message

Karol Sadza

unread,
Aug 30, 2022, 4:21:23 AM8/30/22
to Google Ads Scripts Forum
Hi, 
after migration to New scripts experience, i have problem with one of my script:
var adGroupIterator = AdsApp.adGroups()
              .withCondition("LabelNames CONTAINS_ANY ['n_supp']")
              .get();
          while (adGroupIterator.hasNext()) {
            var adGroup = adGroupIterator.next();
           
            var new_bid = ""
       
      adGroup.bidding().setCpa(new_bid);
I have error: 
setCpa: InputError: Invalid input: "". Expected a non-negative number

In old version it worked just fine.
Could you please check what is causing this error? Thanks in advance.


Google Ads Scripts Forum Advisor

unread,
Aug 31, 2022, 2:33:03 AM8/31/22
to adwords...@googlegroups.com

Hello Karol,

 

This is Maia from the Google Ads Scripts Team. Thank you for reaching out to us.

 

As per the error InputError: Invalid input: "". Expected a non-negative number, this occurred due to the reason that setCpa() accepts a type double parameter. However, you have declared the variable new_bid with double quotation marks which led to the value being interpretted as a type string. For reference, you may check this setCpa documentation.

 

Kindly try to remove the quotation marks and replace the value as 0.0 (e.g. var new_bid = 0.0). Let us know how it goes and should you still encounter any errors, kindly provide the following details below:

 

  • Google Ads CID
  • Script Name

 

Kindly send the details via `Reply privately to author` option. If the said option is not available on your end, you may send those through the email alias <googleadsscr...@google.com> instead.

 

Best Regards,

Google Logo
Angel Maia
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2dtFb5:ref

Karol Sadza

unread,
Aug 31, 2022, 8:27:46 AM8/31/22
to Google Ads Scripts Forum on behalf of adsscripts
Hi, 
thanks for response, I have tried this already but then nothing happened, what I want to accomplish is to set CPC bid to default.

This is my effect with old script experience with var new_bid = "": 
"Ad group target CPA changed from PLN 0.50 to the bid strategy default"

In both versions nothing happened when I set var new_bid = 0.0;

--
-- You received this message because you are subscribed to the Google Groups AdWords Scripts Forum group. Please do not reply to this email. To post to this group or unsubscribe please visit https://developers.google.com/adwords/scripts/community.
---
You received this message because you are subscribed to a topic in the Google Groups "Google Ads Scripts Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-scripts/reYXJnxV9M0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-scrip...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-scripts/Xg6K_000000000000000000000000000000000000000000000RHGVIT00ncA79UFSQ_2LzSsq1Betow%40sfdc.net.


--
Pozdrawiam,
Karol Sadza

Administratorem udostępnionych danych osobowych jest Domodi Sp. z o.o. siedzibą we Wrocławiu (dalej „Domodi”). Domodi przetwarza Twoje dane osobowe, które zostały podane przez Ciebie dobrowolnie w trakcie dotychczasowej współpracy, w związku z zawarciem umowy lub zostały zebrane ze źródeł powszechnie dostępnych, w szczególności: imię i nazwisko, adres email, numer telefonu. Przetwarzamy te dane w celach opisanych w polityce prywatności zamieszczonej na stronach serwisów domodi.pl homebook.pl i allani.pl, między innymi w celu realizacji współpracy, realizacji obowiązków przewidzianych prawem, w celach marketingowych Domodi. Podstawą prawną przetwarzania Twoich danych osobowych w celach marketingowych jest prawnie uzasadniony interes jakim jest m.in. przesyłanie informacji marketingowych o usługach Domodi, w tym zaproszeń na konferencje branżowe, informacje o publikacjach. Twoje dane możemy przekazywać podmiotom przetwarzającym je na nasze zlecenie oraz podmiotom uprawnionym do uzyskania danych na podstawie obowiązującego prawa. Masz prawo m.in. do żądania dostępu do danych, sprostowania, usunięcia lub ograniczenia ich przetwarzania, jak również prawo do zgłoszenia sprzeciwu w przewidzianych w prawie sytuacjach. Prawa te oraz sposób ich realizacji opisaliśmy w polityce prywatności. Tam też znajdziesz informacje jak zakomunikować nam Twoją wolę skorzystania z tych praw.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages