Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spotonlive/laravel-google-ads
Google Ads API for Laravel
https://github.com/spotonlive/laravel-google-ads
ads google laravel
Last synced: 2 days ago
JSON representation
Google Ads API for Laravel
- Host: GitHub
- URL: https://github.com/spotonlive/laravel-google-ads
- Owner: spotonlive
- License: mit
- Created: 2015-12-15T12:11:04.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-08-18T08:20:00.000Z (over 2 years ago)
- Last Synced: 2024-12-16T00:05:37.358Z (9 days ago)
- Topics: ads, google, laravel
- Language: PHP
- Size: 119 KB
- Stars: 64
- Watchers: 18
- Forks: 57
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Laravel 5.1+](https://img.shields.io/badge/Laravel-5.3+-orange.svg?style=flat-square)](http://laravel.com) [![Lumen 5.1+](https://img.shields.io/badge/Lumen-5.3+-orange.svg?style=flat-square)](http://lumen.laravel.com) [![Total Downloads](https://poser.pugx.org/spotonlive/laravel-google-ads/downloads)](https://packagist.org/packages/spotonlive/laravel-google-ads) [![License](https://poser.pugx.org/spotonlive/laravel-google-ads/license)](https://packagist.org/packages/spotonlive/laravel-google-ads) [![Build Status](https://travis-ci.org/spotonlive/laravel-google-ads.svg?branch=master)](https://travis-ci.org/spotonlive/laravel-google-ads) [![Code Climate](https://codeclimate.com/github/spotonlive/laravel-google-ads/badges/gpa.svg)](https://codeclimate.com/github/spotonlive/laravel-google-ads) [![Test Coverage](https://codeclimate.com/github/spotonlive/laravel-google-ads/badges/coverage.svg)](https://codeclimate.com/github/spotonlive/laravel-google-ads/coverage)
## Google Ads API for Laravel
Integration of [`googleads/googleads-php-lib`](https://github.com/googleads/googleads-php-lib) in Laravel and Lumen (version >5).
### Setup
- Run `$ composer require spotonlive/laravel-google-ads`#### Laravel
- **(Only for Laravel 5.4 or minor)** Add provider to config/app.php
```php
'providers' => [
LaravelGoogleAds\LaravelGoogleAdsProvider::class,
],
```- Run `$ php artisan vendor:publish` to publish the configuration file `config/google-ads.php` and insert:
- developerToken
- clientId & clientSecret
- refreshToken#### Lumen
- Add provider to `bootstrap/app.php`
```php
$app->register(LaravelGoogleAds\LaravelGoogleAdsProvider::class);
```- Copy `vendor/spotonlive/laravel-google-ads/config/config.php` to `config/google-ads.php` and insert:
- developerToken
- clientId & clientSecret
- refreshToken- Add config to `bootstrap/app.php`
```php
$app->configure('google-ads');
```### Generate refresh token
*This requires that the `clientId` and `clientSecret` is from a native application.*Run `$ php artisan googleads:token:generate` and open the authorization url. Grant access to the app, and input the
access token in the console. Copy the refresh token into your configuration `config/google-ads.php`### Basic usage
The following example is for AdWords, but the general code applies to all
products.```php
adWordsService = $adWordsService;
}public function campaigns()
{
$customerClientId = 'xxx-xxx-xx';$campaignService = $this->adWordsService->getService(CampaignService::class, $customerClientId);
// Create selector.
$selector = new Selector();
$selector->setFields(array('Id', 'Name'));
$selector->setOrdering(array(new OrderBy('Name', 'ASCENDING')));// Create paging controls.
$selector->setPaging(new Paging(0, 100));// Make the get request.
$page = $campaignService->get($selector);
}
}
```### Best practices
- [AdWords API Workshops Fall 2015](https://www.youtube.com/playlist?list=PLKByxjzUC-N8mEDQF9ARMMkSv0AmYbpsh)
- [Best Practices in Reporting](https://www.youtube.com/watch?v=nRh-sIUqY84&index=2&list=PLKByxjzUC-N8mEDQF9ARMMkSv0AmYbpsh)### Features, requirements, support etc.
See [`googleads/googleads-php-lib`](https://github.com/googleads/googleads-php-lib/blob/master/README.md)### Dependencies
- [`googleads/googleads-php-lib`](https://github.com/googleads/googleads-php-lib) hosts the PHP client library for the various SOAP-based Ads APIs (AdWords, AdExchange Buyer, and DFP) at Google.### Credits
- [`SpotOn Marketing`](https://spotonmarketing.dk/)
- [`nikolajlovenhardt`](https://github.com/nikolajlovenhardt)