Join the Discord – For support, updates and collaboration.
For Google Ads, Bing Ads and Facebook Ads API.
This is a wrapper for connecting each ad source into your Laravel application. This SDK provides simpler and consistent methods across many ad source integrations than the traditional SDKs; ultimately making it a lot easier to implement in your projects. You shouldn't have to learn how to communicate and understand the responses to every API.
Use Composer to install package.
Run composer require tmarois/laravel-ads-sdk
-
Run
php artisan vendor:publish
, If you see multiple options, select the one that sayslaravel-ads-sdk
-
Copy this to your
.env
and update with your credentials (if you dont have credentials, continue to the next step).
ADWORDS_DEVELOPER_TOKEN=""
ADWORDS_OAUTH2_CLIENT_ID=""
ADWORDS_OAUTH2_CLIENT_SECRET=""
ADWORDS_OAUTH2_REFRESH_TOKEN=""
BING_DEVELOPER_TOKEN=""
BING_CLIENT_ID=""
BING_CLIENT_SECRET=""
BING_REFRESH_TOKEN=""
FB_APP_ID=""
FB_APP_SECRET=""
FB_ACCESS_TOKEN=""
FB_REFRESH_TOKEN=""
You will need your developer token, client id and client secret to continue. Learn More
Follow the steps in the command line to generate a refresh token.
Run php artisan laravelads:token:generate --service=GoogleAds
Having Trouble? Learn More
You will need your developer token, client id and client secret to continue. Learn More
Follow the steps in the command line to generate a refresh token.
Run php artisan laravelads:token:generate --service=BingAds
Having Trouble? Learn More
You will need your app id, app secret and access token. Learn More
NOTE: It appears for facebook, you do not need to generate refresh token, once you have your access token, the api should connect as long as you've given yourself the correct access, permissions, scopes to marketing api and ads account.
Accessing GoogleAds
, BingAds
or FacebookAds
use the following:
// The namespace to the Facade for laravel Ads SDK
use LaravelAds;
// calling Google Ads and including the Account ID
$googleAds = LaravelAds::googleAds()->with('ACCOUNT_ID');
// calling Bing Ads and including the Account ID
$bingAds = LaravelAds::bingAds()->with('ACCOUNT_ID');
// calling Facebook Ads and including the Account ID
$facebookAds = LaravelAds::facebookAds()->with('ACCOUNT_ID');
This uses the googleads-php-lib SDK for the Google Ads API
NOTICE – You will need to Request Google Ads API Access.
Need help with authentication?
- Fetching - All Campaigns
- Fetching - All Ad Groups
- Management - Campaigns
- Management - Ad Groups
- Offline Conversion Import
- Manual Configuration
- Advanced Options
- Account Performance
- Campaign Performance
- Ad Group Performance
- Final URL Performance
- Placement Domain Performance
- Placement URL Performance
- Search Term Performance
- Age Range Performance
- Gender Performance
This uses the BingAds-PHP-SDK for the Bing Ads API
NOTICE – You will need to Request Bing Ads API Access.
Need help with authentication or sandbox mode?
- Fetching - Get Customers
- Fetching - All Campaigns
- Fetching - All Ad Groups
- Management - Campaigns
- Management - Ad Groups
- Offline Conversion Import
- Manual Configuration
- Account Performance
- Campaign Performance
- Ad Group Performance
- Final URL Performance
- Search Term Performance
- Age Range Performance
- Gender Performance
- Custom Fields
This uses the facebook-php-business-sdk for Facebook Marketing API
We are actively looking for new contributors.
If you want to contribute, Join the Discord channel and/or submit pull requests.
Laravel Ads SDK (This Package) is open-sourced software licensed under the MIT license. USE AT YOUR OWN RISK. Laravel Ads SDK is a tool to help you manage your accounts, it does not guarantee features listed here will work as described. If you do find a bug, please feel free to submit an issue. This package is not affiliated with Laravel LLC or the Laravel Framework team.