1. Connecting Budget to Spend
These datasources & views allows you to connect your in-platform spend to your campaigns (or adsets) budget & run dates within your creative and/or budget sheet to automatically calculate current pacing for live campaigns.
On top of that, it also allows you to single out campaigns which are over-pacing, find gaps in campaigns with spend vs what is tracked in your creative / budget sheet, and leverage the same views to create Actions to automatically pause over-pacing campaigns.
In this example, we will be connecting Facebook campaigns, but this could be leveraged for other platform, as long as you can create a spend datasource for that platform in Alli Data.
Instructions
Data Source Set-Up
Set up your Creative/Budget Sheet Datasource
In your Creative/Budget Sheet, your Campaign or AdSet name must be included as a column.
You can still connect them without, but it would require much more in-depth SQL than what follows. So we recommend adding a column if it does not already exist, and placing the campaign name within it to allow the connection between your creative budget sheet and Facebook to be simple & easy.
Login to Alli Data and select the client you want to create a data source for
Navigate to Reports, select Add New Datasource
Select the data source type (Google Sheets, Smartsheet, Airtable, etc). Give your data source a new name.
Make sure start & end date columns are separate (one start date, one end date) and are pulled in as timestamp data types
Ensure budget columns can be pulled in as numbers (ie remove extra commas or $ in the fields)
Set up your Platform Spend Datasource
Login to Alli Data and select the client you want to create a datasource for
Navigate to Reports, select Add New Datasource, and select the datasource type: In this example, select
Facebook Ads
Ensure you include the following columns:
Date (Start Date & End Date are automatically selected her, they do not reference the start & end date of the campaign or adset, just the date the data was pulled/ingested)
Account Id & Account Name
Campaign Id & Campaign Name
(optional) Adset Id & Adset Name (if your tracking budgets down to the adset level, and have start/end dates and budget broken out by adset in your creative/budget sheet)
Spend
(optional) other metrics like Impressions, clicks, etc.
SQL View Set-Up
Create your base SQL
Login to Alli Data and select the client you want to create an action for
Navigate to Reports → Explorer and select New Data Report
Give your report a Name and update the Report Type to Custom Redshift
Copy and paste the SQL Example in from below and update anything within and including
{
}
to match your client settingsOnce your SQL is updated, click Publish to update the query
Click Preview to ensure the output is as expected
SQL Example
Context
Depending on whether you are tracking budgets to the campaign or adset level, you’ll select the appropriate SQL from below
replace
{clientname.creative_budget_sheet}
with the name of the datasource you created above for your creative / budget sheetreplace
{clientname.facebook_datasource}
with the name of the Facebook datasource you created abovemaster.start_date
&master.end_date
should reference the column names of your campaigns start & end dates in your creative / budget sheet. If the column name is different, switch out every instance with your new namesie if your start date column is named
campaign_start_date
, master.start_date in line 3, 10, and 13 would change tomaster.campaign_start_date
master.campaign_name
should reference the column name of your campaign’s name within the creative / budget sheet. If the column name is different, replace every instance ofmaster.campaign_name
with your new column namemaster.budget
should reference the column name of your campaign’s budget within the creative / budget sheet. If the column name is different, replace every instance ofmaster.budget
with your new column name
Tracking Budgets to Campaign Level
select
master.campaign_name,
master.start_date,
master.end_date,
sum(spend.spend) as total_spend_to_date,
master.budget
from {clientname.creative_budget_sheet} as master
left join {clientname.facebook_datasource} as spend
on master.campaign_name = spend.campaign_name
and spend.date_start >= master.start_date and spend.date_start <= master.end_date
group by
master.campaign_name,
master.start_date,
master.end_date,
master.budget
Tracking Budgets to Adset Level
select
master.adset_name,
master.start_date,
master.end_date,
sum(spend.spend) as total_spend_to_date,
master.budget
from {clientname.creative_budget_sheet} as master
left join {clientname.facebook_datasource} as spend
on master.adset_name = spend.adset_name
and spend.date_start >= master.start_date and spend.date_start <= master.end_date
group by
master.adset_name,
master.start_date,
master.end_date,
master.budget