Ad spend sync
Overview
Section titled “Overview”Every connected ad account (see Ad accounts) has its spend imported automatically into the site it belongs to. The imported spend is the Spend used by the Performance report, the LTV and cohort reports and the Ad spend card of the analytics dashboard.
There is nothing to schedule: the sync runs in the background as soon as an account is connected.
The only manual control is Backfill on an account row in
Analytics settings › Ad accounts (/t/<workspace>/analytics/settings?tab=ads).
How it works
Section titled “How it works”What is imported
Section titled “What is imported”For each connected account, amabledata imports two kinds of data.
Ad entities. The campaign → ad set → ad hierarchy of the account, with for each entity: the platform id, its parent, its name, its status as reported by the platform and, for campaigns and ad sets, the budget when the platform exposes one. “Ad set” is the generic name used across platforms (Meta ad sets, Google Ads and TikTok ad groups). Names let reports show readable labels instead of ids.
Daily spend. One row per platform, entity and day, with:
| Field | Meaning |
|---|---|
| Day | The local day of the ad account (its own time zone), YYYY-MM-DD. |
| Spend | Amount spent, stored in integer minor units of the account currency. |
| Currency | The account currency reported by the platform. |
| Clicks | Clicks reported by the platform. |
| Impressions | Impressions reported by the platform. |
| Reported conversions | The conversions the platform itself attributes to the entity. |
| Reported revenue | The conversion value the platform itself attributes to the entity. |
Reported conversions and revenue are what the platform claims. They are kept separately from the conversions amabledata tracks, so the Performance report can show both side by side in the Reported conversions, Reported revenue and Tracked vs reported columns.
Spend is pulled at all three levels (campaign, ad set and ad). Reports always read a single level per platform, so the levels never add up twice.
Granularity
Section titled “Granularity”Spend is stored per day. There is no hourly breakdown in reports. Days follow the ad account’s
time zone, which is read from the platform when you connect. Reports select spend days by date
(YYYY-MM-DD) within the report range, so if the account and the site use different time zones the
day boundaries differ slightly.
Schedule
Section titled “Schedule”The core worker runs a cron every 5 minutes. At every tick, each connection decides on its own what is due:
| Job | When it runs | Range pulled |
|---|---|---|
| Current day | At most once every 55 minutes per connection (in practice hourly). | Today, in the account’s time zone. |
| Daily reconciliation | Once per local day of the account, from 03:00 account time. | The 7 closed days before today. |
| Entity refresh | When the spend mentions an entity that is not known yet, or every 24 hours. | The whole entity list of the account. |
| First sync | Right after connecting or reconnecting. | Today, plus the 7 previous days (the first reconciliation). |
Each pull overwrites the stored range: a day of an entity that the platform no longer reports in that range is set to zero. This keeps late corrections from the platform (refunds of invalid clicks, delayed attribution) in sync.
Backfill window
Section titled “Backfill window”The automatic sync only looks back 7 days. To import older history, or to force a refresh of a range, use Backfill:
- range of 1 to 90 days, inclusive;
- the end date cannot be after today (account time zone);
- the range is pulled again at every level and overwrites what is stored;
- the toast reports Spend re-imported (
<n>rows).
A backfill also works on a connection in Error. It is not available on disconnected connections. On a successful backfill the connection returns to Active.
Currency
Section titled “Currency”No currency conversion is performed. Spend is stored in the currency of the ad account, and reports add spend amounts as they are. Reports are expressed in the site currency (set on the site in Analytics settings).
For correct ROAS, profit and CPA figures, use ad accounts whose currency is the same as the site currency. Revenue recorded in another currency is also left out of attributed revenue (see Money and time zones).
Amounts are converted from the platform’s decimal format to minor units with the currency’s own number of decimals (0 for currencies such as JPY or KRW, 3 for currencies such as KWD or BHD, 2 otherwise), rounding half up.
Errors and retries
Section titled “Errors and retries”| Error kind | Typical cause | Connection status | Retry |
|---|---|---|---|
| Temporary | Timeout, HTTP 408/425/429, HTTP 5xx | Unchanged; the error text is shown on the row | Next 5-minute tick |
| Authorization | HTTP 401/403, revoked or expired token, missing authorization | Reconnect needed; owners and admins get an email | None until you reconnect |
| Permanent | Any other rejection, platform no longer configured | Error | At most once per hour |
A failure on one connection never stops the others. Each error text is truncated to 500 characters.
Step by step
Section titled “Step by step”Re-import a date range
Section titled “Re-import a date range”- Open Analytics settings › Ad accounts and pick the site.
- On the account row, click Backfill. The dialog Re-import spend opens with the hint Pulls the spend of the range again and overwrites it (at most 90 days).
- Set From and To. The default range is the last 30 days ending today. To cannot be after today and From cannot be after To.
- Click Backfill. The button is disabled while the range is invalid; the dialog then shows Pick a range of 1 to 90 days.
- When the import finishes, the toast Spend re-imported (
<n>rows) appears and the dialog closes.
Check that spend is syncing
Section titled “Check that spend is syncing”- Open Analytics settings › Ad accounts.
- Each row shows synced followed by the time of the last successful sync. It should be less than about an hour old.
- A red box under the row shows the last error. See Troubleshooting.
- Open the Performance report grouped by Platform to see the imported Spend.
Reference
Section titled “Reference”Timing constants
Section titled “Timing constants”| Setting | Value |
|---|---|
| Cron frequency (core worker) | Every 5 minutes |
| Current day re-pull interval | 55 minutes |
| Reconciliation window | 7 closed days |
| Reconciliation start | 03:00, ad account time zone |
| Entity dictionary refresh | 24 hours, or on unknown entity |
| Retry of a connection in Error | Once per hour |
| Backfill maximum | 90 days |
| Access token refresh | When less than 2 hours from expiry |
Backfill API
Section titled “Backfill API”POST /api/v2/t/<workspace>/analytics/ads/connections/{id}/backfill?site_id=<site> with body
{ "from": "YYYY-MM-DD", "to": "YYYY-MM-DD" }. The answer is
{ "connection_id", "from", "to", "rows" }. An invalid range answers a validation error with the
message from <= to <= <today>, at most 90 days.
Limits and permissions
Section titled “Limits and permissions”- Running a backfill needs
analytics:configure(owner, admin, marketer by default). - Seeing the sync status needs
analytics:read. - Spend is imported only for connections that are Active or in Error. Connections in Reconnect needed or Disconnected are skipped.
- Disconnecting keeps all spend already imported; it simply stops adding new days.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| synced never right after connecting | The first sync failed. | Read the red error under the row; retry with Backfill on today. |
| Spend appears only for the last 8 days | The automatic sync covers today and the previous 7 days. | Run Backfill for older ranges (90 days per run; run several times for longer history). |
| Spend of yesterday changes the next morning | The daily reconciliation re-pulls the last 7 closed days and overwrites them. | Expected: the platforms correct their numbers after the fact. |
| ROAS looks wrong by a constant factor | The ad account currency differs from the site currency; no conversion is made. | Use ad accounts in the site currency, or change the site currency. |
| Toast The authorization expired: reconnect the account. during a backfill | The token was rejected. | Reconnect the account. |
| Toast The ad platform did not answer. Try again in a moment. | Temporary platform failure during a backfill. | Retry later. |
| Row on Reconnect needed, no new spend | Sync is paused until the account is reconnected. | Reconnect, then Backfill the gap. |
| Campaigns show as ids instead of names | The entity list was not refreshed yet. | Wait for the next sync (it refreshes entities when it meets an unknown id) or run a Backfill. |

