Whether you are a marketer, content creator or paid social media specialist, you know how important it is to efficiently manage your Google Ads campaigns, but handling each campaign manually can be very tough, time-consuming, tiring and boring.
If you have even a little coding knowledge, scripts will be very helpful for you.
Scripts can be like your personal assistant for Google Ads.
What are scripts in Google Ads?
In Google Ads, scripts are a method or an automation tool that can make your campaigns very easy and smart. Simply put, Google Ads scripts are code snippets that automate routine tasks of your ad campaigns, track performance data, and implement optimizations.
If you manage daily campaigns, you can save both time and resources by using Google Ads scripts. These scripts are written in JavaScript language and can monitor your campaigns in real-time, generate reports and send alerts under specific conditions.
How do Google Ads Scripts work?
Google Ads scripts add automation to your campaigns, such as:
1. Reporting and Tracking: Ad performance and keyword performance reports are automated
2. Budget Control and Bids Optimization: Campaign budget and bid adjustments are based on hourly or daily data
3. Ad Scheduling: Bid adjustments can be set on the basis of high conversion hours.
Example: If a keyword has a low click-through rate (CTR), you can set a script that sends you an alert or pauses that keyword.
What Benefits Do Google Ads Scripts Provide?
• Time Efficiency: Can automate daily manual tasks
• Campaign Optimization: Can improve campaigns based on real-time data
• Cost-Effective: Scripts help you get better ROI as they manage campaigns efficiently.
But… if you don’t know JavaScript, don’t worry, we will cover everything in this guide!
But… What is exactly JavaScript?
Javascript is light weight which can be used to create interactive web pages, it can also be used in web development apps, which can be used in scripts like JavaScript in Google Ads. With the help of this language you can automate tasks in your campaigns, generate reports, or much more.
How to create scripts in Google Ads?
Step 1: Access the Scripts Page
First of all, login to Google Ads account and then go to “Scripts” page. After that you will get this option in the “Bulk Actions” menu on the left side.
Step 2: Create a New Script
From the script editor, click on the “+ New Script” button on the Scripts page so that you can create a new script. Before using it you need to know basic JavaScript. This will open a blank script, you can write your script (code) there.
Step 3: Write Code
In the editor, you can write your script that will help you achieve your campaign goals. Like, if you can write or set your keyword performance, generate ad performance report as per your requirement.
Step 4: Preview and Test
Before running any script, always preview and test it. By clicking on the “Preview” button you can see how the script will work and any errors can also be detected.
Step 5: Save and Run
If everything is correct, then “Save” your script and apply the changes.
Effective Scripts Tips & Best Practices
1. Goal Set: Before writing code, clear the goals. What do you want to achieve, then write the code accordingly.
2. Keep it Simple: Keep the code simple and efficient
3. Use comments as easily as possible: By adding comments in the code, you can add comments to every section so that you can understand it later also.
4. Focus on Testing: Don’t forget to test the script so that you can find any errors.
5. Schedule or Monitor: Scripts can be set on schedule and performance can be monitored on regular basis.
Some Useful Google Ads Scripts Which Can Optimize Campaigns
- Ad Performance Report Script
function main() {
var report = AdsApp.report(
'SELECT CampaignName, AdGroupName, Headline, Impressions, Clicks, Conversions ' +
'FROM AD_PERFORMANCE_REPORT ' +
'WHERE Impressions > 0 ' +
'DURING LAST_7_DAYS');
var rows = report.rows();
while (rows.hasNext()) {
var row = rows.next();
Logger.log(row['CampaignName'] + ' > ' + row['AdGroupName'] + ' > ' + row['Headline'] + ': ' +
row['Impressions'] + ' impressions, ' + row['Clicks'] + ' clicks, ' +
row['Conversions'] + ' conversions');
}
This script generates a report containing ad performance data. It will give data of impressions, clicks and conversions for the last 7 days, so you can analyze the effectiveness of your campaign.
- Keyword Performance Monitor Script
function main() {
var keywords = ['keyword1', 'keyword2', 'keyword3'];
var threshold = 1.5;
var email = 'example@example.com';
var report = AdsApp.report(
'SELECT CampaignName, AdGroupName, Criteria, Impressions, Clicks, Ctr, CostPerClick ' +
'FROM KEYWORDS_PERFORMANCE_REPORT ' +
'WHERE Criteria IN ["' + keywords.join('", "') + '"] ' +
'DURING LAST_7_DAYS');
var rows = report.rows();
while (rows.hasNext()) {
var row = rows.next();
if (row['Ctr'] < threshold) {
sendEmailAlert(email, row['CampaignName'], row['AdGroupName'], row['Criteria'], row['Ctr']);
}
}
}
function sendEmailAlert(email, campaign, adgroup, keyword, ctr) {
var subject = 'Low CTR for keyword ' + keyword;
var body = 'The keyword "' + keyword + '" in campaign "' + campaign + '", ad group "' + adgroup + '" has a CTR of ' + ctr + '.';
MailApp.sendEmail(email, subject, body);
}
This script monitors the CTR (click-through rate) of some specific keywords. If the CTR falls below the threshold, you are sent an alert email letting you know which keywords need to focus more on.
Ad Schedule Adjuster Script
function main() {
var campaignIterator = AdsApp.campaigns().get();
while (campaignIterator.hasNext()) {
var campaign = campaignIterator.next();
var report = campaign.targeting().hourOfDay().get();
var bidModifierList = [];
while (report.hasNext()) {
var row = report.next();
var hourOfDay = row.getTimeOfDay();
var conversions = row.getConversions();
if (conversions > 0) {
var conversionRate = row.getConversionRate();
if (conversionRate > 1) {
bidModifierList.push({
x: hourOfDay,
y: 1.2
});
} else {
bidModifierList.push({
x: hourOfDay,
y: 0.8
});
}
}
}
campaign.targeting().setBidModifier(
"HOUR_OF_DAY",
bidModifierList
);
}
}
This script adjusts the campaign bid based on hourly conversions. This hourly bid can be increased or decreased depending on the conversion rate to make the best use of the budget.