AdWords location extensions show your business address, phone number, and a map marker with your ad text. Until recently, business location information could only be managed by using the legacy location extensions and CampaignAdExtensionService. Legacy location extensions are being phased out and your application will need to be able to handle the upgraded location extensions.
- Most AdWords API applications need to be able to handle upgraded location extensions linked to Google My Business.
- Otherwise, if you are an AdWords API developer managing upgraded manual location extensions, see instructions on how to configure upgraded manual location extensions.
Upgraded location extensions with Google My Business
If you are an advertiser with a Google My Business account then read on to find out how to use the AdWords API to automatically create location extensions and keep them in sync with your Google My Business account.
Background
Until recently, if you had a Google My Business account and an AdWords account using manual location extensions, you had to maintain your business location information in both accounts. This meant that every time you changed a phone number, address, etc. of an existing business in Google My Business, you had to remember to make the corresponding change to your AdWords location extensions. In addition, if you opened a new location or closed an existing location, you had to add or remove the corresponding AdWords location extension.
With upgraded location extensions, you don't have to worry about keeping your Google My Business locations and AdWords location extensions in sync. Simply perform a one-time setup of the required feed objects and you're done! AdWords will automatically keep its location extensions synchronized to the latest data from your Google My Business account.
This section guides you through creating the required feed objects programmatically using the AdWords API. For more details on location extensions, including a comparison of unupgraded and upgraded location extensions, see this AdWords help center article.
Procedure
If you aren't familiar with the concept of feeds in AdWords, read through the feed guide for sitelinks. These instructions build off of that guide.
The steps required to configure upgraded location extensions are as follows:
- Perform a
FeedService.mutate
ADD operation on a new Feed with:
- systemFeedGenerationData = a PlacesLocationFeedData object
- origin = the ADWORDS enum
- No feedAttributes specified. AdWords will create these for you automatically because this is a system-generated feed.
- Perform a
CustomerFeedService.mutate
ADD operation on a new CustomerFeed with:
- feedId = the ID of the feed from step 1
- placeholderTypes
= an integer array with a single element of 7 (the placeholder
type for
LOCATION
) - matchingFunction = a Function that always evaluates to true
With the above objects in place, AdWords will automatically keep your upgraded location extensions in sync with the locations in Google My Business. In feed terms, this means that AdWords will automatically add, edit, and remove FeedItems as the locations in your Google My Business account change. You don't need to maintain these feed items--in fact, you will get an exception if you try to make changes to feed items in this type of feed. Instead of directly editing your feed items you can use various filtering strategies to control which Google My Business locations show up in your ads.
If you are familiar with feeds for other extensions you may have noticed that the steps above did not include creating a FeedMapping. Since this feed is a system-generated feed, AdWords already knows how to map the feed's attributes to the placeholder fields for location extensions so there's no need for you to provide that information.
The code example in each client library shows how to use the API to perform the steps above.
Creating the PlacesLocationFeedData object on the Feed
Setting the systemFeedGenerationData attribute on your feed tells AdWords to:
- Link your Google My Business and AdWords accounts.
- Automatically create feed attributes for your feed.
- Automatically create a FeedMapping for your feed and the
LOCATION
placeholder type. - (Optional) Limit the set of locations that AdWords syncs from your Google My Business account.
Set the attributes of your PlacesLocationFeedData object as follows:
Attribute | Required | Description |
---|---|---|
emailAddress | Yes | The email address of your Google My Business account owner or one of its managers. |
oAuthInfo | Yes | OAuth2 information that grants your AdWords account access to your Google My Business account. |
businessAccountIdentifier | No | The Google+ Page ID of the Google My Business location to sync to AdWords. |
businessNameFilter | No | Name of the business to sync to AdWords. |
categoryFilters | No | Categories of the businesses to sync to AdWords. |
Creating the OAuthInfo object on the PlacesLocationFeedData
The oAuthInfo attribute on your PlacesLocationFeedData provides the information required to ensure that your AdWords account is allowed to read locations from your Google My Business account.
Set the attributes of your OAuthInfo object as follows:
Attribute | Value | Description |
---|---|---|
httpMethod | GET or PUT |
The HTTP method for getting authorization information. |
httpRequestUrl | https://www.googleapis.com/auth/adwords |
The OAuth scope for the AdWords API. Always use the value shown here when setting up a Google My Business feed. |
httpAuthorizationHeader | Bearer OAUTH_ACCESS_TOKEN |
The
authorization header
containing the OAuth access token that grants your AdWords account permission to read from
your Google My Business account. In place of OAUTH_ACCESS_TOKEN ,
substitute an access token generated from OAuth credentials for the
emailAddress of the
PlacesLocationFeedData
and a scope matching httpRequestUrl . |
Complete code examples
Each AdWords API client library includes an end-to-end example of how to create location extensions from your Google My Business account.
Upgraded Manual Location Extensions
Background
If you programmatically create AdWords accounts that are not associated with any user, then your manager account can continue managing upgraded location extensions without linking to any Google My Business accounts.
Procedure
If you aren't familiar with the concept of feeds in AdWords, read through the feed guide for sitelinks. These instructions build off of that guide.
The steps required to configure upgraded manual location extensions are as follows:
- Perform a
FeedService.mutate
ADD operation on a new Feed with:
- origin = the USER enum
- All location feeds attributes defined.
- Perform a FeedMappingService.mutate ADD operation on a new FeedMapping with:
- feedId = the ID of the feed from step 1
- placeholderType = an integer array with a single element of 7 (the placeholder type for LOCATION)
- attributeFieldMappings = map all attributes defined in step 1 to the corresponding placeholder fields.
- Perform a
CustomerFeedService.mutate
ADD operation on a new CustomerFeed with:
- feedId = the ID of the feed from step 1
- placeholderTypes = an integer array with a single element of 7 (the placeholder type for LOCATION)
- matchingFunction = a Function that always evaluates to true
After you've setup a Feed
, FeedMapping
, and CustomerFeed
, you can start
managing locations by using the
FeedItemService.
Filtering location extensions
The upgraded location extensions are automatically applied to every campaign and ad group under the account. You can apply location extensions to a specific ad group or campaign through filters.
Filtering strategies
Upgraded location extensions let you define location filters at several levels of your account using various mechanisms.
Use the matchingFunction
of a CampaignFeed or AdGroupFeed if you want
different locations to appear on ads for different campaigns or ad groups.
The most specific filter takes precedence. For example, let's say you have:
- A CustomerFeed
- A CampaignFeed for campaign A
- An AdGroupFeed for ad group G in campaign A
- Another campaign B that has neither a CampaignFeed nor an AdGroupFeed
With this setup you will get the following behavior:
- Ads serving for ad group G will only show location extensions for items that match the AdGroupFeed's matching function.
- Ads serving for all other ad groups in campaign A will only show location extensions for items that match the CampaignFeed's matching function.
- Ads serving for campaign B will show location extensions for items that match the CustomerFeed's matching function.
Additional filtering strategies when linked to Google My Business accounts
Specific to upgraded location extensions linked with a Google My Business account:
- Feed objects limit the feed items that sync to AdWords via the
businessNameFilter
and/orcategoryFilters
attributes of the PlacesLocationFeedData object. You might use these filters if:- You are using the same Google My Business account with multiple AdWords accounts and each AdWords account is logically associated with a subset of locations.
- You have locations in your Google My Business account that you don't ever want to show up in ads.
- Filters in the Feed determine which locations in Google My Business will have a corresponding feed item in AdWords. Filters in the other objects determine which feed items in AdWords will be used as location extensions for a given combination of customer, campaign, and ad group.
See the sitelinks feed guide for examples of how to create CampaignFeeds and AdGroupFeeds.