Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

UAC Enterprise Dashboard V1

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)


Setup & Installation

1. Create a Google Sheet

Go to Google Sheets, create a new blank spreadsheet, and copy the Spreadsheet ID from the URL — the long string between /d/ and /edit.

2. Add the Script to Google Ads

  1. Log in to Google Ads.
  2. Go to Tools & Settings → Bulk Actions → Scripts.
  3. Click + to create a new script.
  4. Paste the full contents of UAC_Dashboard_V1.js.

3. Configure

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 needed

4. Authorize & Run

Click Authorize, then Run. Monitor progress in the Logs tab. Open your Google Sheet to see the populated dashboard.

5. Schedule (Optional)

Click the clock icon in the Scripts editor to schedule the script to run daily or weekly for automatic updates.


Dashboard Tabs Generated

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

Function Reference

Section 1 — Helper Utilities

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.


Section 2 — Logging Framework

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.


Section 3 — Initialization

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.


Section 4 — Data Extraction

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.


Section 5 — Raw Data Processing

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.


Section 6 — Dashboard Tab Construction

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.


Section 7 — Main Orchestration

main() The script entry point. Runs the full execution in this order:

  1. Creates a temporary sheet to prevent the spreadsheet from being empty during cleanup.
  2. Deletes all existing sheets except the temp sheet.
  3. Calls initializeScript_() to connect to the spreadsheet and account.
  4. Fetches all four data sets: campaigns, assets, conversions, and daily performance.
  5. Creates and hides the 4 raw data sheets.
  6. Builds all 8 dashboard tabs in order.
  7. Deletes the temporary sheet.
  8. Logs completion with a summary.

License

MIT License — Free to use, modify, and distribute.


Built with love by Hassan El-Sisi

About

Enterprise-grade Google Ads Script for Universal App Campaigns (UAC) with comprehensive reporting and dashboard

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages