Facebook Marketing API Power BI Template
This template has been moved to my website: https://t.co/keZQe3FFmL
A simple to use Power BI Template file for Facebook Marketing/Ads API for analysing campaign performance at campaign, ad set and ad levels. The template requires two inputs:
- Ad Account ID
- Access token
Other inputs are optional and have default value set.
The template file has a data model and one report page which shows your campaign insights.
- Pulls data from Facebook Marketing API for last_30d or last_90d AND today (by default last_30d or last_90d does not include today)
- Pulls data for Archived Ads as well for above mentioned periods (by default data for archived ads are not included)
- You can publish this to PowerBI.com, setup daily or hourly refreshes and view your campaign insights!
How to get Ad Account ID?
- Login to your Facebook account.
- From top right drop down select create ads. You will now directed towards Facebook ads manager page.
- Click settings
You'll now see your Ad Account ID.
How to get Access token?
- Create an app in Facebook
- Enable Marketing API
- Get Token with permissions ads_read, read_insights. This token is valid for 90 minutes.
- Go to App Settings->advanced, add the current ad account to the API and save changes
Extend the token
- Go to https://developers.facebook.com/tools/debug/accesstoken
- Copy the token generated in step 3 above, and click "Extend Token", and follow along
- The token now generated is valid for 2 months
- Check if your token is valid or not
- If 500 error comes, get data for last_30d. If using that also you get error, get data with "reporting granularity" as 2 or 5 and then retry. In most cases it works fine.
Note: If you face any other issues in using this please open up an issue in the tracker for me to check and respond.