This document describes how to use the Management API to manage Google Analytics remarketing audiences.
The Management API allows you to
patch remarketing audiences for a Google Analytics property. To learn more about how remarketing audiences work, see the About Remarketing Audiences in Analytics help center article.
The Remarketing Audience resource supports get, delete, list, patch, and update, but the key use cases are:
- List remarketing audiences.
- Create a new remarketing audience.
- Update an existing remarketing audience.
List remarketing audiences
To list all remarketing audiences for a property:
- Use the Management API or Account Explorer to
- Execute the
listmethod of the Remarketing Audiences resource.
See the API reference for details of the
list method for remarketing audience resource.
Create a new remarketing audience
To create a new remarketing audience for a property:
- Use the Management API or Account Explorer to retrieve the
- Use the Management API or Account Explorer to retrieve the view (profile) Id for the
- Use the Google Ads Linkscollection to retrieve an Google Ads account Id for the
linkedAdAccountsproperty is currently limited to only one
linkedAdAccounts.typecan be set to
- Use the Segments collection for options to set the
segmentproperty of the
includeConditions, and if creating a state based audience do the same for the
excludeConditions. Also see the segments reference for defining a segment.
includeConditionscan optionally have values for
excludeConditions.exclusionDurationcan optionally be set to
- Execute the
insertmethod of the Remarketing Audience resource.
The API allows you to create two types of audiences:
SIMPLE audiences you need only construct the
audienceDefinition with a positive
segment, without a NOT operator (the
! character). Should you want to include an exclude condition you must define a
statebasedDefinition; see State Based Audiences to learn more. See the reference example for details.
Update an existing remarketing audience
To update an existing remarketing audience for a property:
- If you already have the Remarketing Audience ID you can call
get, otherwise you can call the
listand select the audience you wish to update.
- Update any of the writable fields and call
updatepassing in the updated audience object.