A professional, enterprise-grade Google Ads Script for Universal App Campaigns (UAC). Automatically pulls data from the Google Ads API and populates a fully-formatted Google Sheets dashboard.
Author: Hassan El-Sisi | Version: V1 | Platform: Google Ads Scripts (JavaScript)
Go to Google Sheets, create a new blank spreadsheet, and copy the Spreadsheet ID from the URL — the long string between /d/ and /edit.
- Log in to Google Ads.
- Go to Tools & Settings → Bulk Actions → Scripts.
- Click + to create a new script.
- Paste the full contents of
UAC_Dashboard_V1.js.
At the top of the script, update the three config constants:
const SPREADSHEET_ID = 'YOUR_SPREADSHEET_ID_HERE'; // Required
const REPORT_START_DATE = '2026-01-01'; // Adjust as needed
const REPORT_END_DATE = '2026-12-31'; // Adjust as neededClick Authorize, then Run. Monitor progress in the Logs tab. Open your Google Sheet to see the populated dashboard.
Click the clock icon in the Scripts editor to schedule the script to run daily or weekly for automatic updates.
| Tab | Name | Contents |
|---|---|---|
| 01 | User Guide | Instructions for using the dashboard |
| 02 | Settings & Config | Configuration reference |
| 03 | Overview Dashboard | KPI cards, pie chart, bar chart |
| 04 | Campaign Performance | Per-campaign metrics with CPA highlighting |
| 05 | Asset Performance | Per-asset/creative metrics with performance labels |
| 06 | Conversion Analysis | Breakdown by conversion action |
| 07 | Daily Performance | Day-by-day trends with sparklines |
| 08 | Recommendations | Automated optimization insights |
safeMicrosToCurrency_(micros)
Converts a Google Ads micros value to a currency float by dividing by 1,000,000. Returns 0 if input is null or undefined.
safeParseInt_(value)
Safely parses a value to an integer. Returns 0 if the value is null, undefined, or not a valid number.
safeParseFloat_(value)
Safely parses a value to a float. Returns 0 if the value is null, undefined, or not a valid number.
getCurrencyFormatString_(currency)
Returns the correct Google Sheets number format string for a given currency code. Supports EGP, AED, SAR, USD, EUR, and GBP. Falls back to a generic format for unsupported currencies.
styleHeader_(range, bgColor)
Applies the standard header style to a range: bold white text, specified background color, centered alignment, and solid borders.
applyAlternatingRowColors_(sheet, startRow, numRows, numCols)
Applies alternating light background colors to data rows for improved readability.
autoResizeColumns_(sheet, numCols)
Auto-resizes all columns up to numCols to fit their content.
hideGridlines_(sheet)
Hides gridlines on the given sheet for a clean, professional appearance.
getOrCreateSheet_(spreadsheet, sheetName)
Returns an existing sheet by name, or creates a new one if it does not exist. Clears all content and removes existing charts before returning.
logInfo_(message)
Logs an informational message to the Google Ads Script console.
logVerbose_(message)
Logs a verbose/debug message to the console. Used for detailed tracing during development.
logError_(functionName, error)
Logs an error message prefixed with the originating function name and the full error details.
initializeScript_()
Connects to the Google Spreadsheet using SPREADSHEET_ID and retrieves the current Google Ads account name, currency code, and timezone. Returns { spreadsheet, accountName, currency, timezone }. Throws an error if the spreadsheet cannot be accessed.
fetchCampaignData_()
Queries the campaign resource via GAQL to fetch all active UAC campaigns (advertising_channel_type = 'MULTI_CHANNEL') with spend in the configured date range. Returns rows with campaign ID, name, status, app settings, and all key metrics.
fetchAssetData_()
Queries the ad_group_ad_asset_view resource to fetch asset-level performance data. Returns rows with campaign, ad group, and asset details (ID, name, type, field type, performance label) plus metrics.
fetchConversionData_()
Queries conversion data segmented by conversion_action. Note: cost_micros is intentionally excluded from this query to avoid the PROHIBITED_SEGMENT API error.
fetchDailyPerformanceData_()
Queries performance data segmented by segments.date to return day-by-day metrics for all UAC campaigns in the date range.
processCampaignData_(spreadsheet, campaignRows, currency)
Writes campaign data to the hidden Raw Data - Campaigns sheet. Applies correct number formats: currency for Cost/Conv Value/CPA, integer for Impressions/Clicks/Conversions, and percentage for CTR.
processAssetData_(spreadsheet, assetRows, currency)
Writes asset-level data to the hidden Raw Data - Assets sheet across 16 columns: Campaign ID, Campaign Name, Ad Group ID, Ad Group Name, Asset ID, Asset Name, Asset Type, Field Type, Performance Label, Cost, Impressions, Clicks, Conversions, Conv Value, CPA, and CTR.
processConversionData_(spreadsheet, conversionRows, currency)
Writes conversion action data to the hidden Raw Data - Conversions sheet with appropriate number formatting per column.
processDailyPerformanceData_(spreadsheet, dailyRows, currency)
Writes daily performance data to the hidden Raw Data - Daily sheet, ordered by date.
createUserGuideTab_(spreadsheet)
Creates the 01 - User Guide tab with instructions on how to use the dashboard, what each tab contains, and how to refresh the data.
createSettingsTab_(spreadsheet)
Creates the 02 - Settings & Config tab showing the current configuration values including date range, account info, and color scheme reference.
createOverviewDashboard_(spreadsheet, currency)
Creates the 03 - Overview Dashboard tab. Reads from Raw Data - Campaigns to compute account-level totals and builds large KPI cards for Total Cost, Impressions, Clicks, Conversions, and Average CPA. Also generates a pie chart (spend by campaign) and a bar chart (top campaigns by spend).
createCampaignPerformanceTab_(spreadsheet)
Creates the 04 - Campaign Performance tab by copying data from Raw Data - Campaigns, applying professional formatting, and highlighting the top 10 best performers (lowest CPA, green) and top 10 worst performers (highest CPA, red).
createAssetPerformanceTab_(spreadsheet)
Creates the 05 - Asset Performance tab by copying data from Raw Data - Assets. Applies correct number formats to all 16 columns and highlights the top 10 best and worst assets by CPA.
createConversionAnalysisTab_(spreadsheet)
Creates the 06 - Conversion Analysis tab with conversion data broken down by conversion action, with appropriate formatting and CPA-based row highlighting.
createDailyPerformanceTab_(spreadsheet)
Creates the 07 - Daily Performance tab with day-by-day metrics and a line chart showing daily spend and conversion trends over the reporting period.
createRecommendationsTab_(spreadsheet)
Creates the 08 - Recommendations tab with automated insights generated from the campaign and asset data, covering budget, bidding, and creative optimization suggestions.
main()
The script entry point. Runs the full execution in this order:
- Creates a temporary sheet to prevent the spreadsheet from being empty during cleanup.
- Deletes all existing sheets except the temp sheet.
- Calls
initializeScript_()to connect to the spreadsheet and account. - Fetches all four data sets: campaigns, assets, conversions, and daily performance.
- Creates and hides the 4 raw data sheets.
- Builds all 8 dashboard tabs in order.
- Deletes the temporary sheet.
- Logs completion with a summary.
MIT License — Free to use, modify, and distribute.
Built with love by Hassan El-Sisi