Google Ads script can be really helpful in automating your work and decreasing the load of manual work. These Ads scripts can also be used by amateurs if the right way of implementation and execution is known. In this step by step guide, you will be able to run your first Google Ads script for finding out the negative keywords conflict in your Google ads account.
Page Contents
1. Write a Script in Google Ads Interface
The first step really begins with writing a script in the Google ads interface. In this case, we are going to use a script for finding out negative keywords conflict in a single account already provided by Google.
- Open this URL in a new tab separately: https://developers.google.com/google-ads/scripts/docs/solutions/negative-keyword-conflicts#source-code
- Copy the source code from this URL and save it on a notepad or somewhere
- Login to your google ads account.
- Click on “Tools”
- Under “Bulk Actions”, click on “Scripts”
- It will open up a new page.
- Click on “+” sign to add a new script.
- There will be default main function (), remove it and remove every other code if you see.
- Now, Paste the script’s source code that you saved in the initial steps
- Here is how your screen will probably look like
I have marked all the important fields in the above interface. You need to perform the following steps
- Name your script at the top
- Authorize your script by clicking on it and giving permission
- and, finally, save this script.
2. Set up the Sheet template for Google ads scripts
- Go to this URL: https://developers.google.com/google-ads/scripts/docs/solutions/negative-keyword-conflicts#setup
- Under the setup, you will be needed to make a copy of the reporting template.
- Make a copy by clicking on “template spreadsheet”
- Ignore the other steps (Highlighted texts below)
- Once you click on the template spreadsheet, it will ask you to make a copy of it and open the spreadsheet in a new tab
- You can rename this spreadsheet if you want to give it another name
- That copy will also get saved in your google drive.
- Edit the sheet permission and also give edit access to this email ID: 4098917112-100000002-account@partnercontent.gserviceaccount.com
- This email ID is from Google service account which google uses to write your spreadsheet to update the negative keywords conflict.
2.1 Replace parameters in the script
- As you can see in the image above, there are three parameters that you need to replace in the script that you saved on the Google ads interface. Those parameters are:
- SPREADSHEET_URL
- RECEIPIENT_EMAILS
- CAMPAIGN_LABEL
- Open your google ads script interface again.
- In the above image, I have marked those fields where you need to update the fields.
- After you have updated, it looks like this (field names different for you though):
2.1.1 Updating parameters
- To update the spreadsheet URL, copy the part just until edit and ignore the rest. This sheet is the same as from step 1 and paste in the script.
- Similarly, put your email ID and campaign label.
- If you do not have any campaign label, just put “All” or any other label that you already have created.
- Now follow this guide in creating a label: https://support.google.com/google-ads/answer/7486653?co=ADWORDS.IsAWNCustomer%3Dtrue&hl=en and remember to name your label as “All”
- Keep these fields within single quotation marks (”) as shown above in the image, that’s important.
- Save the script again
- If you want to add more than one email address, then just add another one separated by a comma.
3. Run your script to find out Negative keywords conflict on your ad account
- You can either run your script from the script interface or from the main script interface. I prefer to run it from the main script interface
- To go to the main Scripts interface, click on the interface on the left panel as shown below
- It will open the main script interface where you can see all the scripts that you have made
- Under the “Actions” column, click on the drop-down button near “Options”
- You see the option to run, duplicate, disable, etc. Just “Run it”
- After running or during the run, the status of the script will keep on changing. It will look something like this:
- Once the run is complete, you will see the status as finished successfully.
- Now, under the results, click on the log statements and it will show you the log
- At the bottom of the log, you will see a spreadsheet URL where all the logs will be there
- This URL is the same as the spreadsheet URL that you feed in the script at the beginning
- The script log looks like this, as shown below:
3.1 How this Script works?
The script uses reports to efficiently fetch all of the negative and normal keywords across the account and checks whether any normal keywords are blocked. All negative keywords are considered, including campaign-level negative keywords, ad group-level negative keywords, and negative keyword lists attached to a campaign.
Whether a negative keyword blocks a normal keyword depends on their match types:
- In general, a negative keyword using a stricter match type than a normal keyword cannot block it, because the normal keyword will match a wider range of search queries. For example, an exact match negative keyword
[silk scarves]
does not block a broad match normal keywordsilk scarves
because the latter would match queries likescarves silk
orwomen's silk scarves
, which the negative keyword does not filter out. - An exact match negative keyword like
[silk scarves]
would only block an identical exact match normal keyword. - A phrase match negative keyword like
"silk scarves"
would block any phrase or exact match normal keyword containing the phrasesilk scarves
. - A broad match negative keyword like
silk scarves
would block any normal keyword (regardless of match type) that contains the wordssilk
andscarves
in any order.
Note that If the script finds any conflicts, it outputs the details to a spreadsheet and sends an email alert to a list of recipients. The script does not create a spreadsheet or send an email if there are no conflicts.
4. Analyze the Negative Keywords log from the script
- Once you open the spreadsheet, it will have the recent logs and it looks like this:
- I have edited this sheet just to show you. But you can see that due to an account level negative keyword which is “free”, a keyword is getting blocked at the ad group level.
- So, you can go and edit the keyword and ad group in order to avoid the negative keyword conflict.
4.1 Setup the script frequency
- You can set the frequency of the script based on the fact that how frequent you make changes to your keywords.
- If you make changes on a daily basis, then set it to daily. Otherwise, you can also set it to weekly or other time frames such as monthly.
- The option to set frequency comes in the main Script window under frequency
Similarly, you can set up other scripts to automate your work. Otherwise, you should also try Google ads automated rules to automate your work.
Hello,
I am getting this error when I run the keyword conflict report:
TypeError: Cannot read property “length” from null. (file Code.gs, line 114)
How do I fix that?