Free n8n flow

Ad spend logger

This workflow checks Meta campaigns once an hour and writes spend, clicks, and impressions into Airtable. It is free. There is no form on this page. You import it into your own n8n and run it there.

The flow file and setup help are in #freebies on our Discord.

How it works

The file on this site is the Meta path: one ad account, Airtable for the daily row, and a second table for a snapshot. A wider copy is published on n8n.io. That published template also talks to Google, TikTok, and Taboola. The JSON you download here does not include those three.

Once an hour, it builds today's date

Schedule Trigger runs every 60 minutes. Format date makes the date strings the later nodes use, including the range Meta's insights call expects.

It lists campaigns, then keeps the ones you named

Get FB Campaigns - Account 1 calls the Graph API for active and paused campaigns on act_YOUR_AD_ACCOUNT_ID. The token in that URL is the placeholder YOUR_META_ACCESS_TOKEN. Extract FB campaigns keeps campaigns whose names contain BRAND, PROSPECTING, or RETARGETING. Change those words to your own naming.

It searches the Airtable table named Daily Ad Spend for rows already stored, matches them by campaign id, then loops. Get Spend Data asks Meta for spend, impressions, and clicks for that campaign and day. Compile Ads data lines the numbers up with the campaign.

Airtable gets two kinds of rows

  • Daily Ad Spend is updated with an upsert when the campaign already has a row.
  • Daily Snapshot gets a new row so you can see the numbers at that hour, not only the latest overwrite.

What you need

Nothing in this file reads $env. The Meta token sits in the campaign URL as a placeholder. Airtable uses an n8n credential.

  • Meta. Replace YOUR_AD_ACCOUNT_ID and YOUR_META_ACCESS_TOKEN on Get FB Campaigns - Account 1. The insights URL uses the same token pattern.
  • Airtable. A personal access token credential. Set YOUR_AIRTABLE_BASE_ID, YOUR_AIRTABLE_TABLE_ID (Daily Ad Spend), and YOUR_AIRTABLE_TABLE_ID_2 (Daily Snapshot).
  • Campaign names. Edit the keyword list in Extract FB campaigns or the filter will drop campaigns that do not match.

How to use it

Four steps. The file in #freebies is rup-ad-spend-logger.json.

1

Get the file

Join Discord and open #freebies. The flow file and setup help are there.

2

Import into n8n

In n8n, use Import from File and pick the JSON from #freebies.

3

Connect what it asks for

Add the Airtable credential, paste the base and table ids, and replace the Meta account id and token.

4

Run it

Run Schedule Trigger once. You should see today's campaigns land in Daily Ad Spend, and a snapshot row in the second table. Turn the workflow on when the hour schedule should keep going.

Questions

Does the download include Google, TikTok, and Taboola?

No. The JSON on this page logs Meta only. Template 16792 on n8n.io is the multi-platform publish of the same idea.

How often does it run?

The schedule is every 60 minutes. Change the interval on Schedule Trigger if you want a slower pull.

Which campaigns get logged?

Only campaigns whose names contain BRAND, PROSPECTING, or RETARGETING, until you edit that list.

What lands in Airtable?

Spend, impressions, and clicks for the matched campaign, upserted into Daily Ad Spend, plus a snapshot row in the second table.

A small note

Goat O Mate is a community of builders shipping marketing and AI automations together.

Join Discord