Metrics

Custom metrics from Google Sheets

Define a metric backed by a Google Sheet so rules can act on numbers Meta never sees. This page of the AdOps documentation sits in the Metrics section, last updated 20 August 2026. AdOps runs rules — conditions plus actions — against your Meta Ads campaigns on the schedule you set.

Updated

Key facts

Supported data source
Google Sheets the Data Source Type select offers "Select source type" and "Google Sheets"
Fields a metric needs
4 spreadsheet ID, Sheet Name, Column ID and Value Column
Row matching key
the campaign id AdOps looks for the row whose lookup column equals the campaign id
In-memory sheet cache
2 minutes since last access
Read order
CSV export, then the Sheets API, then the last rows stored in MongoDB

A custom metric lets an AdOps rule act on a number Meta never sees. You point AdOps at a Google Spreadsheet ID, a sheet name, a lookup column and a value column; at evaluation time AdOps finds the row whose lookup column matches the campaign id and returns that row’s value column as the metric.

What is this for?

Margin, cost of goods, offline revenue, a stock level, a per-campaign target your finance team maintains. Any number a human keeps in a spreadsheet can become a rule condition, or a budget amount, or a token stamped into a campaign name.

The typical shape is one row per campaign:

campaign_idtarget_roasmargin
238512345678901232.50.42
238512345678904563.00.31

With Column ID set to campaign_id and Value Column set to target_roas, a rule can compare live Purchase ROAS against a target that differs per campaign and that your team edits in a spreadsheet.

Creating the metric

Open Custom Metrics under Rule in the sidebar and press + Add New. The form is two cards.

Basic Information takes the Metric Name, the Google Spreadsheet ID and a Description. The spreadsheet field is hinted “Found in the spreadsheet URL” with the helper “Leave empty if not using Google Sheets”.

Metrics Configuration starts with a Data Source Type select — “Select source type” or “Google Sheets”. Choosing Google Sheets reveals Sheet Name, Column ID and Value Column.

Press Create Metric to save, or Save as Draft to come back to it. In edit mode the header reads Update Custom Metrics, the primary button becomes Update Metric, and Save as Draft is hidden.

When validation fails

AdOps reads the sheet before saving and checks that both columns exist. If they do not, a red Google Sheets Validation Failed modal lists each problem — for example that a Column ID was not found in a named sheet, followed by the columns that actually are there — plus a How to fix checklist.

The two failures worth checking first are a spreadsheet AdOps cannot open, and a column name that does not match the sheet’s header exactly, including case and trailing spaces.

How the number is read at run time

AdOps fetches the sheet through Google’s direct CSV export endpoint with a 30-second timeout. If that fails it retries through the Sheets API, and if Google is unreachable entirely it serves the last rows it stored for that sheet.

Rows are also held in an in-memory cache keyed by spreadsheet and sheet name, with a two-minute window measured from the last access. That is what lets hundreds of campaigns in one batch share a single spreadsheet read. It also means the window can keep extending under continuous access, so treat a custom metric as a number that updates in minutes, not seconds.

Because the MongoDB fallback exists, a spreadsheet whose sharing has been revoked can keep resolving from stored rows. After changing a sheet’s permissions, re-save the metric in AdOps to confirm it still validates.

Using it in a rule

Every metric picker in the rule builder has two tabs: Meta Ads and Custom metrics. A custom metric can be:

  • the metric in a condition,
  • the compared metric in a metric-to-metric condition,
  • a budget action’s value, by setting value_3 to custom_metric,
  • a token in an Add to name template, written {custom_metric|<id>}.

Saved rules resolve stored ids back to metric names, so a task summary reads “Blended ROAS” rather than a database id, and the same substitution happens in the execution log. An id that no longer resolves renders in red — that is your signal that a metric was deleted while a rule still refers to it.

The AdOps custom metric editor mapping a Google Spreadsheet: a spreadsheet id, a sheet name, a column to match campaigns on and a column holding the values. Sample data
Point AdOps at a sheet, name the matching column and the value column, and your own number joins the metric list.
A column in a Google Sheet becomes a condition you can rule on. Map it once and the builder treats it like any Meta metric. No sound. 7 sec No sound

Step by step

The same sequence the interface walks you through, in order.

  1. 01

    Prepare the spreadsheet

    Put a single header row at the top of the sheet. One column holds the lookup key, one column holds the number you want AdOps to read. AdOps matches a row by the campaign id, so the lookup column should contain campaign ids.

  2. 02

    Copy the spreadsheet ID

    Take the long id from the spreadsheet URL between /d/ and /edit. The Google Spreadsheet ID field in AdOps carries the hint "Found in the spreadsheet URL".

  3. 03

    Open Custom Metrics and press + Add New

    Custom Metrics sits under Rule in the left sidebar. The list page has a "Search metrics" box, a Sort by menu offering Date Created, Name and Result Type, and a primary "+ Add New" button.

  4. 04

    Fill in Basic Information

    Enter a Metric Name (hint "Choose a unique, descriptive name", placeholder "e.g., Monthly Revenue Target"), paste the Google Spreadsheet ID, and write a Description that says what the number means and who maintains it.

  5. 05

    Configure the data source

    In Metrics Configuration set Data Source Type to Google Sheets. Three fields appear — Sheet Name (placeholder "e.g., Sheet1"), Column ID (placeholder "e.g., Date") and Value Column (placeholder "e.g., Revenue"). Column ID is the lookup column; Value Column is the number that is returned.

  6. 06

    Save and clear any validation errors

    Press Create Metric. AdOps reads the sheet and checks that both columns exist. On failure a red "Google Sheets Validation Failed" modal lists every problem, names the columns it did find, and shows a How to fix checklist.

  7. 07

    Use the metric in a rule

    In the rule builder open any metric picker and switch to the Custom metrics tab. A custom metric can be a condition metric, a compared metric, a budget value, or a token inside an Add to name template.

Questions about this page

What does a custom metric actually return?

One number per campaign. AdOps opens the configured sheet, finds the row whose lookup column matches the campaign id, and reads that row's value column.

How fresh is the number a rule sees?

Sheet rows are held in an in-memory cache whose two-minute window is measured from the last access, not from the fetch. Under continuous access — a large batch reading the same sheet for many campaigns — the same snapshot can be served for longer, so do not design a rule that depends on sub-minute spreadsheet freshness.

What happens if Google is unreachable?

AdOps falls back to the last rows it stored for that sheet, so rules keep evaluating rather than failing. The same fallback can mask a revoked share, so re-check the sheet in AdOps after you change its permissions.

Where can I use a custom metric?

Anywhere a metric is chosen — a condition, the compared side of a metric-to-metric condition, a budget action's value, or a token inside an Add to name template.

Read it once, then write the rule.

Everything in this manual describes a screen you can open today. Start a trial and follow along in the product rather than on the page.

Start free trial Documentation

14 days free · no card required

Inside the product

What the screens actually look like

Nine screens from the working dashboard — the rule builder, the metric picker, the dayparting grid and the log that records what happened. Scroll the strip.

  • The AdOps Performance Dashboard showing a Purchase ROAS card at 2.380x and an Aggregated ROAS card at 2.088x, both badged Profitable, a Monthly Budget card at Rp 155jt, and a Spend Breakdown ranking the top five ad accounts against a budget utilisation bar at 45.5 per cent.
    Performance Dashboard. Two ROAS figures to three decimals, a budget meter, and spend ranked by ad account — over Today, Last 7 days, Last 30 days or This month.
  • The AdOps rule list showing twelve automation rules, each with an on/off toggle, the ad accounts it manages, and when it last triggered — some minutes ago, others on a dated timestamp.
    Rule List. Every rule, what it manages and when it last fired. The toggle is the only thing between draft and live.
  • The AdOps condition builder showing a task with time-of-day conditions across seven day tags, a nested AND group holding a lifetime spend condition under 400,000, and a second task with four stacked metric conditions.
    Conditions. Metric, period, operator, value — joined with AND or OR, and nestable, so a rule can say something a dropdown cannot.
  • The AdOps metric picker open over a condition row: a panel with Meta Ads and Custom metrics tabs, a search box, and a scrolling list of metrics with Spend selected.
    Metric picker. Forty-five Meta metrics and your own sheet columns in the same list, each carrying a reporting period and any of six operators.
  • The AdOps dayparting timetable: a grid of hours against the seven days of the week, with the daytime hours filled navy for every day and the night hours and weekend evenings left empty.
    Dayparting grid. Or draw the hours instead. Anything outside the shape you fill in simply does not run.
  • An AdOps execution log detail: one campaign, two action panels badged Not Executed, each listing the action parameters and every condition evaluated with its actual value, its expected value and a Pass or Fail badge.
    Rule Log detail. Why a rule did nothing is recorded as carefully as why it did something — actual against expected, condition by condition.
  • The AdOps activity log listing budget increases and campaign renames, each row naming the affected campaign by id, the rule that caused it and how long ago it happened.
    Activity Log. One row per change AdOps made in your account, naming the campaign and the rule responsible.
  • The AdOps ad account list: eighteen Meta ad accounts with on/off toggles, account ids, Active or Inactive badges and this month’s spend in rupiah.
    Ad Accounts. Accounts discovered from Meta arrive switched off. Nothing is read, and nothing is changed, until you turn one on.
  • The AdOps custom metric editor mapping a Google Spreadsheet: a spreadsheet id, a sheet name, a column to match campaigns on and a column holding the values.
    Custom metric. Point AdOps at a sheet, name the matching column and the value column, and your own number joins the metric list.

Every figure is rebuilt from the product’s own interface and filled with invented data — no customer name, ad account or spend figure appears anywhere on this site. See how a run works