{"id":9031,"date":"2023-04-13T14:48:43","date_gmt":"2023-04-13T14:48:43","guid":{"rendered":"https:\/\/craighordlow.com\/index.php\/2023\/04\/13\/a-google-ads-script-that-uses-gpt-to-write-rsas\/"},"modified":"2023-04-13T14:48:43","modified_gmt":"2023-04-13T14:48:43","slug":"a-google-ads-script-that-uses-gpt-to-write-rsas","status":"publish","type":"post","link":"https:\/\/craighordlow.com\/index.php\/2023\/04\/13\/a-google-ads-script-that-uses-gpt-to-write-rsas\/","title":{"rendered":"A Google Ads script that uses GPT to write RSAs"},"content":{"rendered":"<p>Managing <a href=\"https:\/\/searchengineland.com\/guide\/what-is-paid-search\" target=\"_blank\" rel=\"noopener\">PPC<\/a> campaigns efficiently requires using the right mix of tools. <\/p>\n<p>Google Ads scripts have long been one of my favorites because they are completely customizable, scale reasonably well, and are included for free with any Google Ads account.<\/p>\n<p>But there\u2019s a new kid on the block \u2013 GPT. Could we combine generative AI with Google Ads scripts?\u00a0<\/p>\n<p>That was the question I set out to answer, and the result is my first Google Ads script that uses GPT.\u00a0<\/p>\n<p>It identifies opportunities for responsive search ads (RSAs) and uses GPT to help generate additional creative assets to capitalize on the opportunity.<\/p>\n<p>You can grab the script code at the end of this article and try it on your own account.\u00a0<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/craighordlow.com\/index.php\/2023\/04\/13\/a-google-ads-script-that-uses-gpt-to-write-rsas\/#Why_you_should_use_the_maximum_number_of_assets_for_RSAs\" >Why you should use the maximum number of assets for RSAs<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/craighordlow.com\/index.php\/2023\/04\/13\/a-google-ads-script-that-uses-gpt-to-write-rsas\/#Using_the_script\" >Using the script<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/craighordlow.com\/index.php\/2023\/04\/13\/a-google-ads-script-that-uses-gpt-to-write-rsas\/#Download_the_script\" >Download the script<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/craighordlow.com\/index.php\/2023\/04\/13\/a-google-ads-script-that-uses-gpt-to-write-rsas\/#Limitations_of_GPT_for_Google_Ads\" >Limitations of GPT for Google Ads<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/craighordlow.com\/index.php\/2023\/04\/13\/a-google-ads-script-that-uses-gpt-to-write-rsas\/#Combining_Google_Ads_with_generative_AI\" >Combining Google Ads with generative AI<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Why_you_should_use_the_maximum_number_of_assets_for_RSAs\"><\/span>Why you should use the maximum number of assets for RSAs<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Responsive search ads (RSAs) are a type of ad format on Google Ads that allow advertisers to create multiple headlines and descriptions for a single ad.\u00a0<\/p>\n<p>Google then uses machine learning to test different combinations of headlines and descriptions to determine which ones perform best for different search queries and user contexts.\u00a0<\/p>\n<p>This helps improve ad relevance and performance and allows advertisers to reach a wider audience.\u00a0<\/p>\n<p>We found that RSAs <a href=\"https:\/\/www.optmyzr.com\/blog\/optmyzr-study-responsive-search-ad-performance\/\" target=\"_blank\" rel=\"noopener\">drive 4X the impressions<\/a> of expanded text ads, and ads with more headline variants got more impressions per ad than those with fewer variants.<\/p>\n<div class=\"wp-block-image\">\n<\/div>\n<p>Google allows advertisers to submit 15 versions of their headline and four versions of their description for every RSA.\u00a0<\/p>\n<p>While that doesn\u2019t mean that 43,000 variations of your assets will gather equal impressions, it\u2019s always a good idea to feed the machine the maximum allowed number of assets so that its algorithms can show your ads to every interested user.\u00a0<\/p>\n<p>But let\u2019s face it, writing 15 great headlines and four long descriptions for every ad group in your account can get tedious. So it\u2019s no surprise that many advertisers have gaps in their RSAs.<\/p>\n<p>PPC management tools make it easy to find and fix this issue. But there are also ways to do this at scale without paying for additional software.\u00a0<\/p>\n<p>Google Ads scripts are among the best free tools for bulk operations on ad accounts.<\/p>\n<p>Last year, I wrote a <a href=\"https:\/\/www.closedloop.com\/closed-loop-and-optmyzr-launch-rsa-report-script\/\" target=\"_blank\" rel=\"noopener noreferrer\">script<\/a> with Matt Umbro, a long-time PPC thought leader and founder of #ppcchat on Twitter, to create a list of RSA ads with missing assets.\u00a0<\/p>\n<p>But that was before ChatGPT raised public awareness of generative AI. So I decided to see if I could combine scripts and <a href=\"https:\/\/searchengineland.com\/chatgpt-api-seo-guide-394411\" target=\"_blank\" rel=\"noopener\">GPT\u2019s API<\/a> to improve an ad account.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Using_the_script\"><\/span>Using the script<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The script creates a spreadsheet with one RSA on every row and column for every headline and description asset.\u00a0<\/p>\n<div class=\"wp-block-image\">\n<\/div>\n<p>When an RSA is not using the maximum number of variations allowed by Google, it calls the GPT API to suggest additional ad text variations.\u00a0<\/p>\n<p>These AI-generated suggestions are then placed in the spreadsheet to be bulk-uploaded back to Google to easily create the missing assets.\u00a0<\/p>\n<p>To make it easy to see what was generated by GPT, those cells are automatically colored green.<\/p>\n<div class=\"wp-block-image\">\n<\/div>\n<p>In order to run this script, you will need to get an API key from <a href=\"https:\/\/platform.openai.com\/account\/api-keys\" target=\"_blank\" rel=\"noopener noreferrer\">OpenAI\u2019s website<\/a> and add the key to the script around line 39 where it says:\u00a0<\/p>\n<p>var OPEN_AI_API_KEY = &#8221;; \/\/ get your own API key at https:\/\/platform.openai.com\/account\/api-keys <\/p>\n<p>You can run the script in preview mode and look at the logs to get the URL of the new spreadsheet.<\/p>\n<div class=\"wp-block-image\">\n<\/div>\n<p>Every time the script runs, it will use the OpenAI API. This costs money, so <strong>do not<\/strong> put this script on an automatic schedule.\u00a0<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Download_the_script\"><\/span>Download the script<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Grab a copy of the code <a href=\"https:\/\/gist.github.com\/siliconvallaeys\/2dc8eb8b8f2fc992428ab2b66ce78f2f\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>:<\/p>\n\n<p>If you\u2019re new to Google Ads Scripts, you can follow the <a href=\"https:\/\/support.google.com\/google-ads\/answer\/188712?hl=en\" target=\"_blank\" rel=\"noopener noreferrer\">instructions here<\/a> to set it up for the first time.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Limitations_of_GPT_for_Google_Ads\"><\/span>Limitations of GPT for Google Ads<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>While GPT is great at writing, it\u2019s notoriously bad at counting. I asked it why, and here\u2019s what it explained:<\/p>\n<p>\u201cAs an AI language model, GPT (Generative Pre-trained Transformer) is not inherently bad at math. However, it may not perform as well as specialized math models because it was not specifically trained on mathematical tasks. GPT is primarily designed for natural language processing, which involves understanding and generating human language. While it can perform basic mathematical operations, it may struggle with more complex calculations.\u201d<\/p>\n<p>For our PPC use case, you\u2019ll have to double-check the length of assets it suggests to ensure they fit in Google\u2019s character limits.\u00a0<\/p>\n<p>When I asked GPT to add character counts next to each suggested headline, you can see it usually comes close but gets it wrong:<\/p>\n<div class=\"wp-block-image\">\n<\/div>\n<p>Experience has taught me that GPT tends to follow patterns found in the prompt when completing a task.\u00a0<\/p>\n<p>This means it\u2019s more likely to write headlines of an appropriate length when working with a list of existing headlines like the ones you currently have in your account.\u00a0<\/p>\n<p>Hence, the script will work best for completing RSAs that are missing just a few elements rather than most or all elements.<\/p>\n<p>As you can see in the earlier screenshot, it also sometimes tends to give numbered lists of suggestions, and that doesn\u2019t make for great ads when each of your headlines starts with \u20181),\u2019 \u20182),\u2019 etc.<\/p>\n<p>I would not let GPT auto-generate ads because I\u2019m hesitant to let some of Google\u2019s suggestions go on automation.\u00a0<\/p>\n<p>When I accidentally turned on <a href=\"https:\/\/searchengineland.com\/reassess-google-ads-recommendations-391025\" target=\"_blank\" rel=\"noopener\">automatically applied recommendations<\/a> for redundant keywords, it removed my brand keyword, Optmyzr, from my account.<\/p>\n<p>Take GPT\u2019s work as a suggestion to help speed up generating new ad variants.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Combining_Google_Ads_with_generative_AI\"><\/span>Combining Google Ads with generative AI<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>GPT is one of the most exciting new technologies since the invention of the internet. <\/p>\n<p>It\u2019s mind-blowing how well it understands questions and how confident (though not always accurate) it is in its responses.<\/p>\n<p>I am excited to have another fantastic tool in my PPC toolkit to help my ads outperform the competition. <\/p>\n<p>I hope this script gives you a taste of what is possible when you combine Google Ads with generative AI like GPT.<\/p>\n<p>The post <a href=\"https:\/\/searchengineland.com\/google-ads-script-gpt-responsive-search-ads-395548\" target=\"_blank\" rel=\"noopener\">A Google Ads script that uses GPT to write RSAs<\/a> appeared first on <a href=\"https:\/\/searchengineland.com\/\" target=\"_blank\" rel=\"noopener\">Search Engine Land<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Managing PPC campaigns efficiently requires using the right mix of tools. Google Ads scripts have long been one of my favorites because they are completely customizable, scale reasonably well, and are included for free with any Google Ads account. But there\u2019s a new kid on the block \u2013 GPT. Could we combine generative AI with Google Ads scripts?\u00a0 That was the question I set out to answer, and the result is my first Google Ads script that uses GPT.\u00a0 It identifies opportunities for responsive search ads [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"h5ap_radio_sources":[],"cybocfi_hide_featured_image":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-9031","post","type-post","status-publish","format-standard","hentry","category-best-seo-blogs"],"featured_image_src":null,"featured_image_src_square":null,"author_info":{"display_name":false,"author_link":"https:\/\/craighordlow.com\/author\/"},"_links":{"self":[{"href":"https:\/\/craighordlow.com\/index.php\/wp-json\/wp\/v2\/posts\/9031","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/craighordlow.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/craighordlow.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/craighordlow.com\/index.php\/wp-json\/wp\/v2\/comments?post=9031"}],"version-history":[{"count":0,"href":"https:\/\/craighordlow.com\/index.php\/wp-json\/wp\/v2\/posts\/9031\/revisions"}],"wp:attachment":[{"href":"https:\/\/craighordlow.com\/index.php\/wp-json\/wp\/v2\/media?parent=9031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/craighordlow.com\/index.php\/wp-json\/wp\/v2\/categories?post=9031"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/craighordlow.com\/index.php\/wp-json\/wp\/v2\/tags?post=9031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}