Unlike other assets, location assets are automatically created by the Google Ads API after you create an asset set. First, create a location sync asset set and attach it to the customer. Then, if you need to select a subset of the location assets in the asset set for a campaign or ad group, create a location group asset set and attach it to the campaign or ad group.
Create a location sync asset set and attach it to the customer
Create a location sync asset set
- Create a new
AssetSet
.- Set
type
toLOCATION_SYNC
. - Set
location_set
to a newLocationSet
.
- Set
- In the new
LocationSet
,- Set
location_ownership_type
based on your use case:- Set it to
BUSINESS_OWNER
if you own the business location. - Set it to
AFFILIATE
if you don't own the business location, but sell your products there.
- Set it to
- Set the
source
oneof field based on your use case:- Set
business_profile_location_set
if you want to sync with your locations in your Google Business Profile account. - Set
chain_location_set
if you want to sync with locations in specified chain IDs. - Set
maps_location_set
if you want to manually add locations using Place IDs.
- Set
- Set
After you complete the above steps, the Google Ads API will generate location
assets and add them to the created location sync asset set for you, similar to
when you manually do so using
AssetSetAssetService
. You don't need to
manipulate them unless you want to manually add them to a static location
group asset sets.
Only one active location sync asset set with
(status
of
ENABLED
) can exist
for a customer. If you need to create a different type of location sync asset
set, remove the existing one first.
Attach the location sync asset set to a customer
Use
CustomerAssetSetService.MutateCustomerAssetSets
to attach the location sync asset set in the previous section to your customer.
(Optional) Create a location group asset set and attaching it to a campaign or an ad group
A location group asset set is necessary only if you need to select a subset of location assets. This is due to campaigns and ad groups inheriting location assets from the customer level.
Location group asset sets contain a subset of location assets of the location sync asset set. You can dynamically create a location group asset set by leveraging some features of Google Business Profile (like filtering by labels) or chain IDs and chain locations. Alternatively, you can statically create a location group asset set.
- Create a location group asset set. The location group asset set can be dynamic or static.
- Attach the asset set to a campaign using or to an ad group, depending on your need.
- (Optional) Add the previously generated assets to the newly created static location group asset set.
For a given customer, you can create multiple dynamic or static location group asset sets.
Create a location group asset set
Create a new AssetSet
and set
location_group_parent_asset_set_id
to the ID of the previously created
location sync asset set.
Then, set some fields based on whether you want to create a dynamic or static location group asset set.
Dynamic asset sets
Depending on the field you set in LocationSet
, set
the fields based on the following rule:
If you set the following field | Then set type to | And set this field as the asset_set_source oneof field |
---|---|---|
business_profile_location_set |
BUSINESS_PROFILE_DYNAMIC_LOCATION_GROUP |
business_profile_location_group |
chain_location_set |
CHAIN_DYNAMIC_LOCATION_GROUP |
chain_location_group |
If you set maps_location_set
when creating the location sync asset
set, you won't be able to create a dynamic location
group asset set. This is because you've manually added locations by Place IDs
and there are no filtering features you can leverage for this type of locations.
Static asset sets
Set type
to
STATIC_LOCATION_GROUP
.
You can create static location group asset sets for any types of location
sync asset sets, no matter what fields (business_profile_location_set
,
chain_location_set
, or maps_location_set
) you set in the
LocationSet
.
For static location group asset sets, you need to manually add the generated location assets to the location group asset sets.
Attach the asset set to a campaign or to an ad group
Use
CampaignAssetSetService.MutateCampaignAssetSets
to attach the location group asset set to your
campaign.
Alternatively, use
AdGroupAssetSetService.MutateAdGroupAssetSets
if you want to attach the location group asset set to
an ad group instead.
(Optional) Add the location assets to the static location group asset set
This step is required only if you create a static location group asset set previously.
- Use the
asset_set_asset
report to fetch the resource names of assets automatically generated for the previously created location sync asset set. Use filtering to retrieve only the assets you want. - Add them to the static location group asset set using
AssetSetAssetService.MutateAssetSetAssets
.