Questa esercitazione documenta uno script che controlla l'attività dell'obiettivo di conversione in tutti gli account del Centro clienti. Scrive i risultati su un foglio Google, codifica lo stato di salute di ogni obiettivo, codifica a colori lo stato e invia un riepilogo via e-mail solo quando c'è un problema.
Non ci sono strumenti inutili o dashboard di terze parti, solo un controllo grezzo e una visibilità completa.
This script audits every Google Ads account under your MCC and evaluates the status of each conversion goal over a defined lookback period. Instead of guessing which goals are active or broken, this system gives you a real-time snapshot in a Google Sheet and only alerts you when something needs your attention.
Ci saranno due notifiche e-mail: una per gli account che necessitano di attenzione e l'altra per tutti gli account validi.
Example:
Messages:
Got it, your script needs two distinct email outputs:
✅ “All Good” Email (if no issues are found)
⚠️ “Needs Attention” Email (if any goals are inactive, missing, or low-performing)
Here’s precisely how both versions should look, using your sample data and current logic:
Message #1
All monitored conversion goals are reporting activity over the last 60 days.
Nessun problema riscontrato in nessun account.
View the full report:
https://docs.google.com/spreadsheets/d/yoursheetid
Message #2
The following conversion goals may need review (e.g., no recent conversions or inactive):
Bright Widgets Inc (123-456-789) - Contact Form Submission (Needs Attention)
Acme Corp (987-654-321) - Schedule Call (Inactive)
Acme Corp (987-654-321) - Free Trial Signup (Needs Attention)
Rocket Leads (456-789-123) - (configured, no activity) (No Recent Conversions)
Beta Test Group (321-654-987) - (not set) (Inactive)
Zebra Analytics (999-111-222) - Whitepaper Download (Needs Attention)
View the full report:
https://docs.google.com/spreadsheets/d/yoursheetid
Before deploying the script, make sure your environment is configured correctly. This script is designed to run within a Google Ads MCC context to write data and send alerts.
Questo è lo script nella sua forma completa e non modificata. Tutti i commenti, la formattazione e la logica sono esattamente come scritti originariamente. Non modificare questa impostazione se si prevede di seguire la suddivisione più avanti in questa esercitazione.
// ========== CONFIGURATION ========== const SHEET_ID = '1PvpW3eUl5fqRwabBg0P7D8LKzW83MOTVX1KDBMB3ipA'; const LOOKBACK_DAYS = 60; const EXCLUDED_ACCOUNT_IDS = [ '000-000-000', '000-000-000', '000-000-000' ]; const RECIPIENT_EMAILS = '[email protected]'; // =================================== function main() { const sheet = SpreadsheetApp.openById(SHEET_ID).getSheets()[0]; sheet.clear(); sheet.appendRow(['Account Name', 'Account ID', 'Goal Name', 'Conversions', 'Status', 'Date Range']); const startDate = getDateXDaysAgo(LOOKBACK_DAYS); const endDate = getTodayDate(); const dateRangeLabel = `Last ${LOOKBACK_DAYS} days (${startDate} to ${endDate})`; const accounts = MccApp.accounts().get(); const flagged = []; let rowIndex = 2; while (accounts.hasNext()) { const account = accounts.next(); const accountId = account.getCustomerId(); const accountName = account.getName(); Logger.log(`⏳ Checking account: ${accountName} (${accountId})`); if (EXCLUDED_ACCOUNT_IDS.includes(accountId)) { Logger.log(`🚫 Skipping excluded account: ${accountName} (${accountId})`); continue; } try { MccApp.select(account); const query = ` SELECT ConversionTypeName, Conversions FROM CAMPAIGN_PERFORMANCE_REPORT DURING ${startDate},${endDate} `; const report = AdsApp.report(query); const rows = report.rows(); const goalMap = {}; while (rows.hasNext()) { const row = rows.next(); const goalName = row['ConversionTypeName'] || '(not set)'; const conversions = parseFloat(row['Conversions']) || 0; if (!goalMap[goalName]) { goalMap[goalName] = 0; } goalMap[goalName] += conversions; } if (Object.keys(goalMap).length === 0) { Logger.log(`⚠️ No conversion data returned for account: ${accountName} (${accountId})`); const status = 'No Recent Conversions'; sheet.appendRow([ accountName, accountId, '(configured, no activity)', 0, status, dateRangeLabel ]); setStatusColumnColor(sheet, rowIndex, status); flagged.push(`${accountName} (${accountId}) - no conversion goals triggered`); rowIndex++; continue; } for (const [goalName, totalConversions] of Object.entries(goalMap)) { let status; if (totalConversions > 0) { status = 'Active'; } else if (goalName.toLowerCase().includes('test') || goalName === '(not set)') { status = 'Inactive'; } else { status = 'Needs Attention'; } sheet.appendRow([ accountName, accountId, goalName, totalConversions, status, dateRangeLabel ]); setStatusColumnColor(sheet, rowIndex, status); if (status !== 'Active') { flagged.push(`${accountName} (${accountId}) - ${goalName} (${status})`); } rowIndex++; } } catch (e) { Logger.log(`❌ Error processing account: ${accountName} (${accountId}) - ${e.message}`); } } if (flagged.length > 0) { const subject = '⚠️ Conversion Goals Needing Attention'; const body = `The following conversion goals may need review (e.g., no recent conversions or inactive):\n\n` + flagged.join('\n') + `\n\nView the full report:\nhttps://docs.google.com/spreadsheets/d/${SHEET_ID}`; MailApp.sendEmail(RECIPIENT_EMAILS, subject, body); } else { Logger.log('✅ All goals are reporting conversions.'); } } // 🎨 Apply color to only the "Status" column (Column E) function setStatusColumnColor(sheet, row, status) { const range = sheet.getRange(row, 5); // Column E switch (status) { case 'Active': range.setBackground('#d9ead3'); // Light green break; case 'Inactive': range.setBackground('#f4cccc'); // Light red break; case 'Needs Attention': range.setBackground('#fff2cc'); // Light yellow break; case 'No Recent Conversions': range.setBackground('#e6e6fa'); // Light purple break; default: range.setBackground(null); } } // 🕒 Helpers function getTodayDate() { const date = new Date(); return Utilities.formatDate(date, AdsApp.currentAccount().getTimeZone(), 'yyyyMMdd'); } function getDateXDaysAgo(days) { const date = new Date(); date.setDate(date.getDate() - days); return Utilities.formatDate(date, AdsApp.currentAccount().getTimeZone(), 'yyyyMMdd'); }
Questa procedura dettagliata mostra come impostare lo strumento di verifica dello stato dell'obiettivo di conversione per l'account Centro clienti Google Ads. Segui ogni passaggio per far funzionare il sistema, scrivi su Fogli Google e invia avvisi quando qualcosa si rompe.
Inizia impostando la destinazione di output.
Distribuirai questo script all'interno del tuo account Centro clienti.
La prima volta che si utilizza lo script, è necessario autorizzarlo.
È necessario completare questo passaggio o lo script non verrà eseguito.
All'interno dello script, rivedere e modificare quanto segue:
È possibile lasciare il resto dello script esattamente così com'è.
Eseguilo una volta manualmente per assicurarti che tutto funzioni.
Per renderlo automatico, impostarlo in modo che venga eseguito in base a una pianificazione ricorrente.
Lo script verrà eseguito automaticamente e ti avviserà solo quando qualcosa non va.
When the script runs, it checks all conversion goals. If any are inactive or not firing, you receive an email.
Questo script non è solo un dump di dati. È un controllo per ogni obiettivo di conversione nell'intero Centro clienti Google Ads. Ricevi un avviso quando qualcosa si rompe, si blocca o interrompe silenziosamente il tracciamento. Quando tutto va bene, c'è silenzio.
It checks every account you manage, flags inactive or underperforming goals, and delivers a filtered, no-noise report straight to your inbox. The Google Sheet gives you a live view of goal status by account, goal name, and conversion volume, with visual cues baked in.
You’re not digging through interfaces. You’re not waiting until the end of the month to realize you’ve been blind. You’re in control before it becomes a problem.
Check out similar posts:
Check out similar posts:
If gestisci più account, non perderti la nostra guida su monitoraggio dei problemi di GA4 da numerose proprietà o esportatore Termini di ricerca effettivi più performanti con uno script leggero to refine your targeting.
Stanco di indovinare se il tuo tracciamento funziona? Vuoi un team che crei sistemi invece di semplici report?
Bright Vessel non si limita a gestire Google Ads; Progettiamo la visibilità delle prestazioni su larga scala. Che tu abbia bisogno di aiuto per implementare questo script, integrarlo in uno stack di automazione più ampio o creare un livello di analisi personalizzato che ti dica qualcosa, siamo pronti.
Talk to the team that builds what other agencies fake.
"*" indicates required fields
"*" indicates required fields
"*" indicates required fields