Following on our scripts series, we had another request for a very quick and simple script that ensures all your keywords have a final URL that matches what’s already in the account. If you’re adding loads of keywords it’s quite possible to miss a final URL, and for this particular client adding URLs at the ad level was not possible.
This script goes through all of your ad groups, finds the existing final URL that keywords have, and then adds that URL to any keywords in the ad group that currently don’t have a URL. Worth noting that it won’t work if none of the keywords have a final URL, as it won’t know what URL to apply.
This script does actually make changes to your account, so please make sure to preview the script before running it and to thoroughly look through the changes it’s making as well as the logs to ensure it’s doing what you expect it to do!
There’s only one parameter to change, and it only applies if you’re running this in an MCC: the account IDs for all of the accounts in the MCC that you want the script to run on. If you’re running this in a regular account, no need to make any changes – just paste and preview!
/*
_ ___ _ _ _____ ___ _
/_\ / __| | | |_ _/ _ \ (_)___
/ _ \ (__| |_| | | || (_) || / _ \
/_/ \_\___|\___/ |_| \___(_)_\___/
*/
var config = {
// If using this script on an MCC, enter the account IDs for the accounts you want this to run on here. If you're running this on a single account, ignore this!
accounts: ['123-456-7890']
}
function main() {
try {
AdsManagerApp.accounts().withIds(config.accounts).executeInParallel('checkKeywordURLs');
} catch(e) {
checkKeywordURLs();
}
}
function checkKeywordURLs() {
var adGroups = AdsApp.adGroups().withCondition('Status = ENABLED').get();
while (adGroups.hasNext()) {
var adGroup = adGroups.next();
var keywords = adGroup.keywords().withCondition('Status != REMOVED').get();
var adGroupUrl = null;
try {
while (!adGroupUrl) {
var kw = keywords.next();
var finalUrl = kw.urls().getFinalUrl();
if (finalUrl) adGroupUrl = finalUrl;
}
} catch(e) {
Logger.log('Ad group "' + adGroup.getName() + "\" doesn't have any keywords with a final URL - please add at least one so that the script can change all keyword URLs to match!");
}
if (adGroupUrl) {
while (keywords.hasNext()) {
var keyword = keywords.next();
var finalUrl = keyword.urls().getFinalUrl();
if (!finalUrl) {
keyword.urls().setFinalUrl(adGroupUrl)
}
}
}
}
}
How to Use Scripts in Google Ads
Google Ads scripts are Javascript codes that automate tasks in your Google Ads, such as pausing campaigns, reactive bidding and ad customization. Scripts are perfect for marketers managing large campaigns who want to save time and boost efficiency.
Simply insert JavaScript code into the script editor, save, and then you can run it. Here are step by step instructions:
- Sign in to your Google Ads account
- Go to the toolbar and choose the Tools and Settings drop-down menu
- Within the Bulk Actions list, choose Scripts
- Select the blue + icon to make a new script.
- Either opt to create a New script or Start from a template
- Input a name for your new script in the name bar
- Transfer your script code into the editor
- To allow the script to run on your account, you will need to click Authorize
- Finally you can Save & Preview your script
- Make sure to check the logs on your preview to ensure the script will run properly
- Once you’re ready, click Run to implement the script
Display URL vs Final URL in Google Ads
Individual Google ads have two URLs: a display URL and a landing page URL. The landing page URL is made up of two components: the final URL and the tracking template.
The display Google Ads URL is the website address that’s shown in your ad and appears in green in the last line of your ad. An easy-to-read display URL that clearly states what your company can offer will be more likely to attract prospects to click on it.
On the other hand, the final URL directs prospects to the page on your website when they click on your ad. Often, your landing page URL is the same as your final URL.
Is it Necessary to Add a Final URL in Google Ads?
Specifying a final URL in Google Ads is crucial for maximum ad performance because it dictates where prospects land when they click on your ad, thereby impacting your overall CTR and conversions.
In short, Google Ads bases your quality score, pay-per-click and overall ad position on the amount of conversions your ad receives and CTR. The higher your Quality Score, the better your ads will rank, resulting in a lower cost per click.
Because final URLs direct ad traffic, it’s crucial that your landing pages are highly relevant to your prospects, improve user experience and boost conversions.
Why Use Keywords in Google Ads Final URL?
You can insert keywords into your final URL to direct prospects to pages on your website related to particular keywords. This is a great way to optimize ad relevance, landing page performance and create a unified customer experience.
As Google Ads uses landing page relevance to calculate your quality score, adding keywords to your final URL is central to providing customers with concise, relevant content.
By adding parameters to the latter part of the URL string, you can use keyword-level URLs for tracking. This will allow you to see which keywords are driving traffic and where to focus your ad strategy.
How to Change the Final URL in Google Ads
If you want to update a campaign or landing page, you will need to change your final URL to avoid a destination mismatch. Ads that redirect to another URL or have mismatched destinations are against Google Ads policy, so if your final URL is not properly updated, your ad could get taken down.
You can edit single final URLs manually or edit final URLs in bulk with an advanced URL change tool in the following steps:
- Sign into your Google Ads account.
- Click “Ads & extensions” in the page menu.
- Select the ads you want to edit.
- Click “edit” and then “change text ads”.
- Make the necessary changes, click “preview” and then “Apply”.
Google Ads Final URL Report
The Google Ads Final URL report shows you the URLs to which your Google Ads have directed prospects, making it essential for understanding your ads’ performance. With this report, you can see which landing pages generate the most engagement and have the highest conversion rates.
Campaign managers can access the report to verify their final URL after configuration. All you have to do is click All campaigns in the navigation menu on the left in your Google Ads account, and then click Keywords or Ads & assets from the page menu on the left.
You can also use Auto Tagging to automatically import Google Ads data into analytics to get the most out of your data.
Want to automate Google Ads with custom scripts?
If you liked this script or would like a personalized one, we’re here to help! Our team of developers with experience in PPC can create custom scripts to automate any aspect of your Google Ads accounts. Schedule a discovery call to discuss how we can assist you in implementing automation scripts effectively.
Key Takeaways:
- Using ad scripts in Google Ads automates tasks such as reactive bidding and ad customization to save time and boost efficiency.
- You can use scripts by inserting JavaScript code into the script editor, save, and click Run Script Now.
- Google Ads have two URLs: display URL, which is what a prospect will see on the SERP, and final URL, the landing page a prospect will be directed to.
- Google Ads final URL directs traffic and influences user experience, and therefore has a direct impact on your quality score, CTR and cost-per-click.
- Adding keywords into your final URL will boost your ads relevance, thereby improving your CTR, quality score, and PPC.
- Google Ads Final URL report can be used to understand your ads performance and what is driving traffic.