Table of Contents


Have you encountered a requirement where you need to implement Google Ads API? If yes, and wondering how can you do it then here is a blog for you! A few weeks back, one of our developers had a requirement for Google Adwords API integration in the laravel application. And searching for a proper tutorial was a real struggle! That’s when it struck us to come up with a tutorial for fellow Laravel developers.

Without further ado, let’s move ahead and see how to integrate Google Adwords API in Laravel App.

Required Package

We will be needing the following packages to integrate Google Adwords API in Laravel App.


PHP client library for the Google Adwords API.


BCMath is a PHP extension helping us with float values. BC is known for Binary Calculator in BCMath.


The framework gRPC will be used for developing scalable APIs. It will lessen our struggle and allow transparent client-server communication and connected systems.


The protobuf implements Protocol Buffer of Google for PHP language that supports serialization of binary data and includes a protoc plugun for generating classes from .proto files.

Update composer.json with the following packages

Copy Text
composer require googleads/google-ads-php
composer require ext-bcmath
composer require ext-grpc
composer require ext-protobuf

Required PHP Extension

Make sure you have the following PHP modules in your system to integrate Google Adwords API.

  • Bcmatch
  • Grpc
  • Protobuf
  • Soap

Stop searching for the best Laravel developers. Because here we are!
Bacancy will provide you proficient and dedicated developers with fundamental and advanced Laravel knowledge. Contact us to hire Laravel developer today!

Generate client ID and client secret key

Follow these instructions to generate a client ID and client secret key.

  • Open the Google API Console Credentials page.
  • Navigate the following path to create a project: Select a project > NEW PROJECT > Enter project’s name OR Edit the provided project ID. Click Create.
  • Select Create credentials and click on OAuth client ID on the Credentials page.
  • If prompted for setting the product name on the Consent screen, click Configure consent screen, provide the information asked for, and click Save and you will return to the Credentials screen.
  • Select the Application type and click Create
  • Copy your client ID and client secret as you will be needing them for configuring your client library.

Enable Google Ads API

For using the Google Ads API we will need to enable it. So, follow these instructions to enable the Google Adwords API.

Generate Developer Token

Without a developer token, you won’t be able to proceed further. With the help of the below steps generate your developer token.

  • Login to Google Ads Manager account
  • Navigate to TOOLS & SETTINGS > SETUP > API Center. The API Center option appears only for Google Ads manager accounts.
  • Fill out the form to request a developer token.

Note: Only approved developer token will be used for production. A non-approved developer token can only be used with a test account.

Generate Refresh Token

  • Run AuthenticateInDesktopApplication.php or AuthenticateInWebApplication.php in the terminal.
  • To run any of the above files go to path for file then php filename.

Fetch Data using Google Adwords API in Laravel App

So, far we are done with the initial project set up and generating a developer token for using Google Ads API. Now, let’s do some coding.

  • Copy sample google_ads_php.ini to home directory.
  • Set google_ads_php.ini path in app config.
Copy Text
'google_ads_php_path' => realpath(base_path('google_ads_php.ini'))
  • Register GoogleAdsClient in AppServiceProvider
Copy Text
use Google\Ads\GoogleAds\Lib\V9\GoogleAdsClientBuilder;
use Google\Ads\GoogleAds\Lib\OAuth2TokenBuilder;

public function register()
       // Binds the Google Ads API client.
       $this->app->singleton('Google\Ads\GoogleAds\Lib\V9\GoogleAdsClient', function () {
           // Constructs a Google Ads API client configured from the properties file.
           return (new GoogleAdsClientBuilder())
               ->withOAuth2Credential((new OAuth2TokenBuilder())

If you want more details,

Outsource Laravel Development

Github Repository: Google Ads API Integration Demo

You can visit the source code: google-ads-api-demo and play around with the code.


I hope the tutorial on integrating Google Adwords API in Laravel App was helpful to you. If you have any questions or suggestions feel free to contact us. For more such tutorials, visit Laravel tutorials page where you can clone the repository, start exploring the code, and learn about more Laravel.

Laravel Tutorials

Learn Now

Build Your Agile Team

Hire Skilled Developer From Us

[email protected]

Your Success Is Guaranteed !

We accelerate the release of digital product and guaranteed their success

We Use Slack, Jira & GitHub for Accurate Deployment and Effective Communication.

How Can We Help You?