Reddit Ads
Reddit Ads is an advertising platform for creating, managing, and analyzing advertising campaigns on Reddit.
Bruin supports Reddit Ads as a source for Ingestr assets, and you can use it to ingest data from Reddit Ads into your data warehouse.
To set up a Reddit Ads connection, add a configuration item to .bruin.yml and reference it from an ingestr asset. You need OAuth credentials — either an access_token, or client_id + client_secret + refresh_token (recommended, since access tokens expire). See the official ingestr Reddit Ads documentation for the OAuth flow. Account selection is done per asset via the source table name (e.g. campaigns:id_123); by default all accessible accounts are synced.
Configuration
Step 1: Add a connection to .bruin.yml file
To connect to Reddit Ads as a source, add a reddit_ads connection to the connections section of .bruin.yml:
connections:
reddit_ads:
- name: my-reddit-ads
client_id: "app_client_id"
client_secret: "app_client_secret"
refresh_token: "refresh_token_123"access_token(optional): OAuth2 access token used to authenticate with the Reddit Ads API. Access tokens expire (~24h), so prefer supplyingclient_id+client_secret+refresh_tokeninstead, which lets Bruin mint a fresh access token automatically on each run.client_id(optional): OAuth application client ID.client_secret(optional): OAuth application client secret.refresh_token(optional): Permanent OAuth refresh token. Provide this together withclient_idandclient_secretto obtain a fresh access token on every run without manual re-authentication.
You must provide either an access_token, or client_id + client_secret + refresh_token. The refresh-token approach is recommended because access tokens expire, whereas the refresh token is long-lived.
By default, all ad accounts the authenticated user can access are synced. To restrict an asset to specific accounts, scope them in the asset's source table — e.g. campaigns:id_123,id_456 (see below).
Bruin uses the reddit_ads connection key in .bruin.yml. The underlying ingestr source URI scheme is redditads://, as required by ingestr.
Step 2: Create an asset file for data ingestion
Create an asset configuration file to define the data flow:
name: public.reddit_ads_campaigns
type: ingestr
connection: postgres
parameters:
source_connection: my-reddit-ads
source_table: 'campaigns'
destination: postgresname: The name of the asset.type: Specifies the asset type. Set this toingestrto use the ingestr data pipeline.connection: The destination connection, which defines where the data should be stored.source_connection: The name of the Reddit Ads connection defined in.bruin.yml.source_table: The Reddit Ads table to ingest. See Available Source Tables for options.destination: The destination connection name.
Available Source Tables
Reddit Ads source allows ingesting the following tables:
| Table | PK | Inc Key | Inc Strategy | Details |
|---|---|---|---|---|
accounts | id | - | replace | Retrieves all ad accounts accessible by the authenticated user. |
campaigns | id | - | replace | Retrieves campaigns for each ad account. |
ad_groups | id | - | replace | Retrieves ad groups for each ad account. |
ads | id | - | replace | Retrieves ads for each ad account. |
posts | id | - | replace | Retrieves ad posts (creatives) for each ad account. |
custom_audiences | id | - | replace | Retrieves custom audiences for targeting. |
saved_audiences | id | - | replace | Retrieves saved audience configurations. |
pixels | id | - | replace | Retrieves conversion tracking pixels. |
funding_instruments | id | - | replace | Retrieves funding instruments (payment methods) for each ad account. |
custom | [level_id, breakdowns] | date | merge | Custom reports allow you to retrieve performance data based on specific levels, breakdowns, and metrics. |
Example
To ingest campaigns:
name: public.reddit_ads_campaigns
type: ingestr
connection: postgres
parameters:
source_connection: my-reddit-ads
source_table: 'campaigns'
destination: postgresCustom Reports
The custom table uses the Reddit Ads Reports API to retrieve performance data such as impressions, clicks, reach, and spend, broken down by dimensions such as date, country, community, or device.
Format:
custom:<level>,<breakdowns>:<metrics>Parameters:
level(required): Reporting level. Must be one ofaccount,campaign,ad_group, orad.breakdowns(optional): Comma-separated breakdown list after the level. Valid breakdowns includedate,country,region,community,placement,device_os,gender,interest,keyword, andcarousel_card. Reddit Ads supports up to two breakdowns per report.metrics(required): Comma-separated metrics to retrieve, such asimpressions,reach,clicks,spend,ecpm,ctr, andcpc.
By default, ingestr fetches custom report data from January 1, 2020 to the current date. You can provide a custom range with the asset start and end interval settings.
Custom Reports Examples
Retrieve daily campaign performance data
name: public.reddit_ads_campaign_daily
type: ingestr
connection: postgres
parameters:
source_connection: my-reddit-ads
source_table: 'custom:campaign,date:impressions,clicks,spend'
destination: postgresThe applied parameters for the report are:
- level:
campaign - breakdowns:
date - metrics:
impressions,clicks,spend
Retrieve ad group performance by country
name: public.reddit_ads_ad_group_country
type: ingestr
connection: postgres
parameters:
source_connection: my-reddit-ads
source_table: 'custom:ad_group,date,country:impressions,reach,ctr'
destination: postgresThe applied parameters for the report are:
- level:
ad_group - breakdowns:
date,country - metrics:
impressions,reach,ctr
Step 3: Run asset to ingest data
bruin run assets/reddit_ads.asset.ymlAs a result of this command, Bruin will ingest data from the given Reddit Ads table into your destination database.