What you will need
- A Facebook account
- Access to Business Manager + an ad account
Step 1 — Create a Meta App
1
Go to developers.facebook.com → My Apps → Create App.
2
Choose Business as the app type → Next → fill details → Create app.
Step 2 — Add the Marketing API
1
In your app, go to Add products to your app → find Marketing API → Set up.
Step 3 — Create an App ID and Secret
1
Go to Settings → Basic. Copy your App ID and click Show to copy App Secret.
Step 4 — Add a Redirect URL
1
Go to Facebook Login → Settings and add this Valid OAuth Redirect URI:
https://YOUR-DOMAIN.com/market/api/facebook_ads.php
https://YOUR-DOMAIN.com/market/api/facebook_ads.php
Step 5 — Create a System User + Access Token
1
Open business.facebook.com → Business Settings → Users → System Users → Add.
2
Give it a name, assign Admin access if needed.
3
Go to System Users → your user → Add Assets → pick your Ad Account and give permissions like ads_read.
4
Create a Permanent Access Token for Marketing API with ads_read scope. Copy it.
Step 6 — Paste in your App Config
1
Open this file: market/config/facebook_config.php.
2
Update the values like this:
Find your Ad Account ID in Business Settings → Accounts → Ad Accounts (looks like act_1234567890123456).
Step 7 — Connect the Account
1
Visit your site page that starts the Facebook connect (a button in your app).
2
Log in and approve permissions. You will return to your redirect link.
Great! Your app can now read Facebook Ads data for reports.