Google AdWords API – Part 2

Part two is about how to get data from Google AdWords.

Structure

An AdWords account is hierarchically structured:

  • AdWords account
    An AdWords account is unique with its AdWords ID and is a Google account.
  • Campaign
    The main thing here. A campaign defines everything to advertise from something. It can be active, inactive or paused. Campaigns costs money and they generate clicks by getting people to your site.
  • Adgroup
    A campaign is structured by adgroups. These are grouped advertising goods. An adgroup belongs to a campaign and has different ads, keywords and placements.
  • Ads (AdText)
    This are textual ads by Google. One ad consists of an headline and two textrows. You can find such ads on the right side of your Google search results.
  • Keyword
    A keyword is a search value that is put into Googles search field to find a site. You can pay money, that you site can be found/higher ranked with certain keywords.
  • Placement
    This is a graphical ad. It is also called image ad and can be found on websites that use Google AdSense.

Campaigns

Our first goal is to get all campaigns from an AdWords account. For this we have created a AdWords user object that is needed for each individual AdWords account.

You can get campaigns with the CampaignService. For this I used the sample code from the client library and modified it to fits my needs. This function returns an array with campaigns:

This function uses the user object defined in part 1 of my article series. Another param is the AdWords Version. The current version is ‘v201209’.

With the user object we can get the CampaignService. With it we can define and limit our query:

  • Selector
    With a selector we can define which columns need to be returned from the API. A list of all columns per service can be found here. With a selector we can also define which columns are used for sorting.
  • Predicate
    With a predicate object we can limit our query result. For this example we only want campaigns that are active. So we do not want deleted or paused campaigns.
  • Paging
    With the paging object we can get and step through the search result. We run through a loop and store everything we need into an array and return it.

Adgroups

You can get adgroups with the AdGroupService. This is similar to the CampaignService:

The next article is about keywords, adtexts and placements.

Part 1 | Part 3 | Part 4 | Part 5 | Part 6

(Visited 3,013 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *