Google Ads Script to Identify Ad Groups Without Active RSAs (Responsive Search Ads)
Introduction
This script helps you to identify Ad groups in active Google Search campaigns that do not contain any enabled and approved Responsive Search Ads (RSAs). It automates the process of auditing campaigns, saving time and effort while ensuring no ad groups are left without active RSAs.
With a few simple steps, you can generate a CSV report listing the campaign and ad group names that lack active RSAs. The report is saved to your Google Drive for easy access and further analysis.
How to Use
- Log in to your Google Ads account and navigate to the Google Ads Scripts section (Tools -> Bulk Actions -> Scripts)
- Create a new script and paste the provided code into the editor.
- Authorize the script to access your Google Ads and Google Drive accounts.
- Run the script.
- Once the script is finished, in the script history, click the log statements.
- Copy the spreadsheet URL in the log statements, there will be a spreadsheet with list of campaigns and ad groups without active RSAs
Copyright Note
This script is provided under the MIT License, allowing free use and modification for personal or commercial purposes. Please retain the copyright notice included in the script to credit the original author.
Author: Chau Pham
Contact: [email protected]
/**
* Copyright 2024 Chau Pham
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the “Software”), to use,
* copy, modify, and distribute the Software for non-commercial purposes only,
* subject to the following conditions:
*
* 1. The Software may not be used for any commercial purposes or in any
* commercial products, services, or applications without the explicit
* prior written permission of the copyright holder, Chau Pham.
* 2. The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED “AS IS,” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING
* FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* Author: Chau Pham
* Contact: [email protected]
*/
function main() {
const campaignSelector = AdsApp.campaigns()
.withCondition(“AdvertisingChannelType = ‘SEARCH'”)
.withCondition(“CampaignStatus = ‘ENABLED'”)
.withCondition(“ServingStatus = ‘SERVING'”)
.orderBy(“Name”);
const campaigns = campaignSelector.get();
const adGroupsWithoutRSA = [];
while (campaigns.hasNext()) {
const campaign = campaigns.next();
const campaignName = campaign.getName();
const adGroupSelector = campaign.adGroups()
.withCondition(“AdGroupStatus = ‘ENABLED'”)
.orderBy(“Name”);
const adGroups = adGroupSelector.get();
while (adGroups.hasNext()) {
const adGroup = adGroups.next();
const adGroupName = adGroup.getName();
const adSelector = adGroup.ads()
.withCondition(“Type = ‘RESPONSIVE_SEARCH_AD'”)
.withCondition(“CombinedApprovalStatus = ‘APPROVED'”)
.withCondition(“Status = ‘ENABLED'”);
if (!adSelector.hasNext()) {
adGroupsWithoutRSA.push([campaignName, adGroupName]);
}
}
}
// Export the results to a CSV file
if (adGroupsWithoutRSA.length > 0) {
const csvData = [[‘Campaign Name’, ‘Ad Group Name’]].concat(adGroupsWithoutRSA);
const csvContent = csvData.map(row => row.join(‘,’)).join(‘\n’);
const fileName = ‘Ad Groups Without Active RSAs.csv’;
const driveFolder = DriveApp.getRootFolder(); // Save in the root folder
const file = driveFolder.createFile(fileName, csvContent, MimeType.CSV);
Logger.log(`File created: ${file.getUrl()}`);
} else {
Logger.log(‘No ad groups without RSAs found.’);
}
}
Post Comment