In this chapter you'll learn how to use the AdWords API web services to program a web application that allows users to create a campaign, an ad, and keywords in their Google AdWords account.
From a high level, you'll need to:
Get Google's ID for a campaign
One way to accomplish this (shown in this chapter) is to successfully create a new campaign; the ID is part of the return value when the campaign is created.
Use the campaign's ID to create an ad group, and get the ID for the ad group
When you create a new ad group, its ID is part of the return value from the call to the web service that creates the ad group.
Add a creative (a creative is a text or graphical ad) to the ad group
You need the ad group ID to do this.
Add keywords, used for contextual targeting, to the ad
This also requires the Ad Group ID.
Along the way, add various optional and required pieces of information
For example, you can't create a campaign without providing a budget for the campaign, and you can't create an ad group without providing the maximum CPC (cost per click) you are willing to pay for the keywords in the ad group.
It's a good idea to understand how AdWords works before attempting to program with the AdWords API. See Part III for more information about working with AdWords.
If you think these steps sound like a lot of trouble for re-creating functionality that you can find in the Google AdWords application, you are right. There's not much reason for creating a standalone replica of the user interface that Google already provides. Most applications that take advantage of the AdWords API will integrate with other applications, such as a company's internal inventory program, to create a unified system that provides custom functionality beyond what you find in AdWords.
The point of the application in this chapter is to show how to manipulate the objects that make up the AdWords application. Many of the most important of these objectscampaigns, ad groups, creatives, and keywordsare used in the example programs in this chapter. When you understand how to program these objects, you'll be able to code with them in your own custom applications.
You can run the web application in this chapter, and download its source code, at http://www.braintique.com/ad/.