Google Ads script utilizes GPT to summarize the account performance.

Last month I shared with you my first Google Ads script. It identifies missing RSA titles and suggests new variants.

This month I wanted to test the limits of GPT and see if it could write my script for me. Spoiler alert! It worked! It took some help to get there. You’ll learn how I designed the prompt for a successful outcome.

The script that I’m sharing uses OpenAI GPT to create a summary of account performance along with suggestions on how to improve a Google Ads Account.

Making PPC reports more descriptive

PPC reports can be tedious. It’s repetitive by nature because clients and stakeholders are expecting the latest reports to be delivered regularly, whether weekly, monthly or, god forbid, daily.

There are many great reporting tools. (I am employed by one). They can automate the pulling in of data and visualizing, but telling a compelling story and making sense of the data still requires a human touch. GPT is known for its ability to write compelling stories. This seemed like the perfect solution to my problem.

GPT and generative artificial intelligence are both adept at producing high-quality text. Large Language Models have read billions and millions of words. They are very good at predicting the best way to combine words.

They may sound convincing, but they are not always accurate. This is a problem when you want to provide clients with reliable reports.

So I decided to see if I could make GPT correct and an excellent storyteller when it comes to the data within a ads account.

GPT’s Truth Problem

GPT’s core strength is its ability to predict the next word of a string. It is less reliable in terms of fact-checking, and making sure what it says are correct.

The training could have included dozens or blog posts on how to increase conversions with Google Ads.

GPT’s conversion advice will include these tasks, as they are likely to be mentioned in articles about budgeting and CPA targets.

It may be slightly off on the details, such as whether or not an advertiser with a CPA lower than their target CPA should raise ad spend or reduce. GPT doesn’t solve a problem analytically, but predicts the words that should be included in its advice.

The GPT still has a problem with math, despite the efforts of openAI to correct this problem.

It’s not safe for example to assume that a program will be able to calculate the CTR based on facts such as how many impressions and clicks a particular campaign had. It’s easy to remember: clicks/impressions equals CTR.

GPT can be right sometimes, but it’s not guaranteed.

I did the math myself to avoid any mistakes and entered the results into the prompt.

Instead of trusting GPT’s ability to calculate metrics such as CTR, conversion rates, etc. correctly, I entered the values in the prompt.

What information should you provide to GPT about your business?

The task that I wanted to automate included describing the performance of an account last month in comparison to the previous month and making some optimization suggestions.

I could not jump right into the code when creating this automation. I had to create a manual process that worked first before automating it.

First, I experimented with GPT in order to find out what data was needed to stop it from making up stories and instead use the truth to craft its stories. It was necessary to give it Google Ads information with the facts that I wanted it describe.

GPT is able to take a table and interpret it. I exported a table with campaign performance as a CSV file that could be pasted directly into the GPT prompt.

I originally brought in two CSV strings for each date range. I did this because I wanted GPT’s comments on the differences in performance between these two dates.

Two separate CSV strings will use more tokens compared to a single CSV that has separate columns for the different dates ranges.

To make automation work better with larger accounts, I created the combined CSV strings.

After I had the data, I could design the prompt so that it would give me the best possible results.

Prompt engineering

After I had the data, I needed to tell GPT how to use it. The prompt can be as simple or complex as:

GPT knows how to identify the various periods of the CSV files.

Add more details to the prompt if it tends too focus on metrics that you would like to reduce in priority, such as:

Then, I wanted to add some tips on optimization. To make my suggestions more credible and in line with how I manage, I added some extra facts such as these:

GPT began to give solid answers when I sent a detailed request with CSV data and facts.

After assembling all the pieces, I asked GPT to create the automation.

Search for daily newsletters that marketers use.

“> “> “>

Processing…Please wait.

Get GPT to Write Ad Scripts

The code to run a Google Ads account script is not particularly complex. This is a part of most scripts and it’s well documented.

So I crossed my finger and asked GPT if they could write a script for me to pull data with this prompt:

It looked like a great script, but there was one thing that seemed off. The GAQL query I wrote included both date ranges that I wanted to compare into a single query. This is not how it works.

So I asked GPT for another try. While the implementation was slightly different, it still messed up date ranges within the GAQL.

Instead of giving up, I decided to do some quick engineering.

What if I misunderstood GPT in my prompt?

I said it to:

Can I be more specific and say that this should be done as two separate queries which would later be combined?

The prompt was changed to include the following new text:

The result was as follows:

Now GPT was writing correct code. It worked immediately after installing it on my Google Ads account and produced the required CSV data.

This was an excellent lesson in prompt engineering. You’ll need to give very specific instructions if you want to hire someone who has never worked with PPC. Precision is key with GPT!

It is still important to have a good understanding of the subject. A person who has never used GAQL reports or API reports for Google Ads may not be aware that data cannot be obtained from two dates ranges at once. Finding the GPT error could be difficult without this knowledge.

It’s better to use pseudo-code when you ask GPT to create code than to be too vague and just tell it the outputs that you want. The more specific you are in your instructions, the more likely the system is to generate code that will work.

After the code for pulling CSV data worked, I needed code to send this data to GPT and ask for a summation.

Use GPT in Google Ads Scripts

You will need API access to use GPT within a script. Sign up on the OpenAI site. You can then write a function that uses the API, asks for a response and prints it out on the screen.

The code can be obtained from GPT but I already have it from the RSA script from last month so I reused that.

Here is the code to use GPT with Google Ads scripts

Put it together

Then, I combine the two scripts. The first script gathers all the data that I need to create my prompt. The second script then sends this data as a GPT prompt and captures its response.

You can download the entire code from here. Just remember to include your API key before you start using it.

You should then experiment with facts and prompt. You should enter details that you would like GPT to be aware of in the line where you input facts.

GPT will use the information you provide rather than inventing things to summarize the performance.

You can also modify the prompt so that it does what you want.

You could, for example, ask GPT whether to include or exclude certain metrics from its summary, or what style of writing to use, such as conversational or business oriented.

This script is not -free, but uses OpenAI’s API. Every time you run it, money will be spent.

This script should be run as required and not on a schedule.

Summary of PPC performance using GPT

GPT can be excellent at writing, but have issues with factual accuracy. It is important to include as many facts in the prompts as possible.

Google Ads scripts can be used to automatically prepare account performance data in a GPT-compatible format.

This script will help you provide GPT with information about your account. You can then get a summary of performance that can be shared among clients and stakeholders.

Please check it out, and let me what you think.

The article This Google Ads Script uses GPT in order to summarize account performance first appeared on Search Engine Land.

Leave a Reply

Your email address will not be published. Required fields are marked *