From the course: Advanced Google Ads
Automating negative keywords with AI - Adwords Tutorial
From the course: Advanced Google Ads
Automating negative keywords with AI
- [Instructor] For large scale ad accounts, finding irrelevant search terms to exclude from your campaigns can be really time consuming. That's why it's important to use automation with AI to decrease the burden. This is a spreadsheet template that you can use, and it also includes a formula which calls OpenAI. It's a custom function that we've created in Google Sheets. The result is what I'll show you first, and then I'll walk through how this works. So we have all of our search terms here, and this is for a growth hacking marketing agency. And then we have whether they're added or excluded, and then we have whether they should be a negative or not. We're calling ChatGPT through a function called GPT, and we're sending our prompt to ChatGPT. So the prompt is the text that we send, where we're expecting a response to that text. We have the prompt template up here. Says, you are a leading digital marketer working for a top growth hacking marketing agency. That allows ChatGPT to kind of get into a role, and understand what type of response is needed. You're an expert in finding search terms that are relevant to your business, and exclude 'em as negative terms. And then label this keyword if it should be excluded as a negative term, commercially irrelevant to a growth hacking agency based in the UK. Respond only with Negative or N/A. And you can see here that we've excluded these key terms which are really important. They're all coming through as N/A, but then where it says best ppc advertising company, it's identified that as a Negative, and that does look correct. A digital marketing in Belgium, this company operates just in the UK, so that's also correct, it should be Negative. And you can keep going down here as well. It's excluded Canada, it's also excluded clutch.co, which is a registry of digital agencies. You wouldn't necessarily want to bid on their brand term. So it's doing a pretty good job, and we're giving it the context here of what negative keywords we have already. We have that list just down here. This is just a list of negative keywords that are already in the account that we copied across. And then we're using an array formula to join these together with a comma. So if you have a different selection, you just select it here, this is negatives A1 to A113, and that will bring it in here. Then we're adding it to the prompt. And when we say current list of negative keywords, and then we're including that there. We also then include the keyword itself, and we say only respond with the label Negative if the keyword should be excluded as negative, or N/A otherwise, label. So that is the prompt. This is everything we're asking ChatGPT for each one of these keywords every time. We also have here a few other parameters. So I'm going to dive in now, and show you what those parameters mean. The first thing we do is open up Google Apps Script. If you want to open that up, you just go to Extensions, and then Apps Script here. When you open the spreadsheet, it runs this function, and then it makes it available for you to use, and that shows up here, and you click Run, and then that should allow you to run the function. You might need to authorize your account by clicking on the Google login. Okay, the function itself is called GPT, and it sends in the prompt. It also has a couple of parameters that are optional. So we have max tokens, this is how many tokens we want in terms of response, and it's kind of like a character limit, except a token is about four characters on average. And then there's the temperature. The temperature is how creative you want the responses to be. The default is one, but I believe we're using zero for our specific use case. We're also only asking for 10 tokens back 'cause we want a relatively short response. And then we have the stop word, which is null by default. It's not included by default, but if it's there, then we add it to this data object. And what the stop does is it says when we get to a new line, which is after the response, then it stops the AI from continuing, and then continuing to write more and more of these negative or search term keywords. The rest of the data is just a normal way of calling ChatGPT via the API. You specify the model, in this case I'm using the 16k token one, but you can just use the normal gpt-3.5-turbo. These are the default parameters for here. You can look at the OpenAI documentation, there's an API reference, it tells you what all of these things do. And then this is how you send messages to ChatGPT here. Then we're setting up the API call over here, and then running it with this fetchJson function, we're basically using the UrlFetchApp, and then getting back the response, and returning it. Okay, so that explains what these parameters are. We're adding the 10 tokens, we're setting the temperature at zero, and then we're setting the stop at new line. So when it sometimes hallucinates and continues on, it will stop as soon as it creates a new line. Because you have access to this prompt, and you can make changes, you can see it in real time whether it's working or not. So for example, you could say, respond only with Negative, or N/A, or Unsure if you're not sure. And then see if it comes back with anything different. It looks like it hasn't come back with Unsure, but it has still identified the good negatives. So that wouldn't make that much of a difference. We can get rid of that, but we might want to add more context in here. We do offer PPC services as well as growth hacking. (instructor typing) And now we'll see if we have this best ppc advertising company show up. No, it's still coming as a Negative. So this is the role of prompt engineering is really just making changes here, and seeing what we can do to get the AI to pay attention to us. And it does take a bit of time in order to find the right things. Potentially, what I would look at next is the list of negatives, and if we have maybe PPC in here, that could be why it's being excluded. But regardless of how you want to instruct the AI, and you're going to probably experiment with a few different ways to do it for your own tasks, all you need is this spreadsheet. You just need to get an API key. go to the API section here, View API Keys, Create a New Secret Key, and then click Copy, and then paste it in this section here. And that's going to give you everything that you need. You'll be able to call this function once you run GPT. So now you know how to do this, not only will we be able to consistently identify negative keywords to add, and save a lot of wasted ad budget, but you'll also be able to automate a lot of other tasks with Chat GPT too.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.