tl;dr: Do NOT USE the Google Adwords API but the Google Ads API when you build your first integration.

The world is a better place because Google connected us faster and more user friendlier to the internet than other options. However, as the company matured the output of the innovation efforts have stagnated. For example, the self-driving car efforts of Waymo (now part of Alphabet), which started testing since 2009, have been caught up by Tesla. There are now over 250.000 consumer cars on the road from Tesla with advanced autopilot features vs 0 of Waymo. Probably one of the main reasons is that Google is an advertisement company. When looking at the quarterly reports from Alphabet Inc. in Figure 1. you see that the major percentage of revenue and costs are at Google.

Figure 1. Quarterly reports 2018 Q3 Alphabet in millions

The controversy around the firing of James Damore indicates that the culture of Google is not a place that welcomes criticism and diversity of ideas. From the outside, it looks like Google has become a big sluggish enterprise compared to other companies. As Google has a 95% market share in Search in the Netherlands, there is no way around Google when you want to do online advertisement.

The ROI results from Google Adwords are great, and we use it for a few projects. However, the maintenance of ads is time assuming and continuous. Therefore I decided to automate the part by integrating advertisement control into my tutoring platform bijlesaanbod.nl so the customers can manage their ads themselves.

Google Adwords API vs Google Ads API

It took me a day before I spot the difference between the Google Adwords API and the Google Ads API. On the surface both API’s look the same and they require OATH2 authentication, however, they are separate API’s. Google Ads API is their new API in beta but it contains all standard features. I could not get the OAth to work for the older Adwords API. The main reason seems to be that it is not in the list of the API libraries and the Adwords API does not connect to the Google Ads API library.

Your first API call in Google Ads API

There are many steps needed to get to your first API Call:

1. Create a production Adwords manager account and request a developer API token (Tools -> API center in Adwords).

2. Create a test manager account from a new Google account with this form.
3. From the test manager account create a test client account. Note that the test client does not appear in the account list on a page refresh so go to the test client account and bookmark the page of the test client (the customer ID number of the test client is important).
4. Create a campaign in the test client.
5. Go to the Google developer console and create a new project from your Google account with the Test manager.
6. Select the Google Ads Library and enable it for the project.
7. Go to Credentials and create a new OAth client ID (select Other and give it a name). Store the Client ID and the Client Secret.
8. Select a Client Library.
9. For PHP run the AuthenticateInStandaloneApplication.php script with a PHP console in a PHP CLI.
10. Paste the requested information (Client ID, Client Secret).
11. The script should return a working URL. Copy and paste it in an incognito window and log in with your Google account with the test manager.
12. The web page should open with an authorize button, click it and it should provide a token.
12.2. In case of problems try using the Google OAuth2 Playground instead of the script.
13. Paste the token in the PHP script, and this should finally give you a Refresh Token!
14. Add all the information in your environment, for the PHP client this in a google_ads_php.ini file in your root folder.
15. You should now be able to make a call with the API from PHP and develop your API using the CustomerID of the test client account.

16. When you are happy with how the API is integrated request a production status on the developer token and follow steps 5 to 14 to get a production Client ID. A production Client ID does not work with a test manager account.

Discussion

I hope that this article helps to get people started with the Google Ads API. I expect that the API itself is less complex than the way to get to your first API call. I guess the lack of competition is a reason for the current complicated flow to get to your first API call. For Google, I would suggest allowing simpler methods with just an API key to develop your integrations or at least improve the test account interface by showing test accounts connected to the test manager.

Documentation of the Google Ads API can be found here

Cover Photo by tangi bertin, note Don’t Be Evil is no longer in Alphabet’s code of conduct


Leave a Reply

Your email address will not be published.