Combining Automated Bid (Target CPA) + Script

50 views
Skip to first unread message

Adit Ruessi

unread,
May 17, 2024, 6:24:28 PMMay 17
to Google Ads Scripts Forum
Hi, 
I have recently started working on google scripts and I would like to ask for help on the following case:

I am running a Target CPA bid strategy campaign (Automated Bidding), and I notice that certain keywords have a very high conversion rate. So, I would like to improve the top of page Impression or increase the Keywords bid to have the ads show up on the Top.

Is it possible? I have researched and it seems to be possible to fine-tune an automated bidding strategy. 

Here is the script I worked on: 

function main() {
  // Define the label used to identify target keywords
  var LABEL_NAME = "Top_Position"; // Replace with your label name
  var bidIncreasePercentage = 0.2; // Increase bid by %

  // Define the maximum CPC limit
  var MAX_CPC_LIMIT = 12.00; // Adjust the limit as needed

  // Email address to send notifications
  var EMAIL = "my_email";

  // Initialize a variable to track changes
  var changesMade = false;
  var changeLog = [];

  // Get the keywords with the specific label
  var keywordsIterator = AdsApp.keywords()
      .withCondition("LabelNames CONTAINS '" + LABEL_NAME + "'")
      .get();

  while (keywordsIterator.hasNext()) {
    var keyword = keywordsIterator.next();

    // Get the first position bid estimate
    var stats = keyword.getStatsFor("LAST_30_DAYS"); // Adjust the date range if needed
    var firstPageCpc = stats.getFirstPageCpc();
    var topOfPageCpc = stats.getTopOfPageCpc();
    var firstPositionCpc = stats.getFirstPositionCpc();
    var currentCpc = keyword.bidding().getCpc();

    // Increase the bid by bidIncreasePercentage, respecting the maximum CPC limit
    if (firstPositionCpc !== null) {
      var newCpc = currentCpc * (1 + bidIncreasePercentage);
      if (newCpc <= MAX_CPC_LIMIT) {
        keyword.setMaxCpc(newCpc);
        changesMade = true;
        changeLog.push("Keyword: '" + keyword.getText() + "', Label: '" + LABEL_NAME + "', New CPC: " + newCpc + ", First Position Bid: " + firstPositionCpc + ", Max CPC Limit: " + MAX_CPC_LIMIT);
        Logger.log("Keyword: '" + keyword.getText() + "', Label: '" + LABEL_NAME + "', New CPC: " + newCpc + ", First Position Bid: " + firstPositionCpc + ", Max CPC Limit: " + MAX_CPC_LIMIT);
      } else {
        Logger.log("Keyword: '" + keyword.getText() + "', Label: '" + LABEL_NAME + "', Current CPC: " + currentCpc + " increased by " + bidIncreasePercentage*100 + "% would exceed Max CPC Limit.");
      }
    } else {
      Logger.log("Keyword: '" + keyword.getText() + "', Label: '" + LABEL_NAME + "': No first position bid estimate available.");
    }
  }

  // Send email notification if changes were made
  if (changesMade) {
    var subject = "Bid Changes Made in Google Ads Script";
    var body = "The following changes were made:\n\n" + changeLog.join("\n");
    MailApp.sendEmail(EMAIL, subject, body);
  }
}

Nils Rooijmans

unread,
Jun 2, 2024, 3:13:37 AMJun 2
to Google Ads Scripts Forum
When you are running Target CPA bid strategy , or any other smart bidding algorithm, the bid strategy will place a CPC bid for you. 
You do not have direct control over the CPC bids; the bids you set at the keyword level will be ignored.

Some ways to try to increase your IS  :

1) If you are happy with the current CPA, AND your campaign is limited by budget, meaning 'Search lost IS (Budget)' > 0% ---> simply increase budget (I recommend steps of 20%)

2) If your current CPA is below your targets, AND your campaign is NOT limited by budget ---> try increasing your CPA target (again, I recommend steps of 20%)

3) If your current  CPA  is around your target or higher---> improve your ad quality. 
   Also see https://support.google.com/google-ads/answer/6167130?visit_id=638516356303037699-3656695430&rd=1


Hope this helps,

Nils Rooijmans
https://nilsrooijmans.com
See my Google Ads Scripts FAQ to avoid the same mistakes I made: https://nilsrooijmans.com/google-ads-scripts-faq/

Google Ads Scripts Forum Advisor

unread,
Jun 2, 2024, 9:45:49 PMJun 2
to adwords...@googlegroups.com
Hi,

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

@ Nils - Thank you for your input.

You may follow Nil's suggestion. Let me know how it goes on your end and If you face any issue, provide us with the following details to replicate the issue from our side: 

  • Google Ads account ID / CID
  • Name of the script

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.!5004Q02tJAEF:ref" (ADR-00237518)

Thanks,
 
Google Logo Google Ads Scripts Team


İstanbul Mobil cilingir

unread,
Jun 14, 2024, 8:31:57 PM (7 days ago) Jun 14
to Google Ads Scripts Forum
komut dosyasını çaliştıramıyorum 

3 Haziran 2024 Pazartesi tarihinde saat 04:45:49 UTC+3 itibarıyla Google Ads Scripts Forum Advisor şunları yazdı:
Reply all
Reply to author
Forward
0 new messages