This document describes how to use the Management API to manage Google Analytics remarketing audiences.
Introduction
The Management API allows you to create
, get
, delete
, list
, update
and 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.
Use cases
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
retrieve the
accountId
andwebPropertyId
. - Execute the
list
method 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
accountId
andwebPropertyId
. - Use the Management API or Account Explorer to retrieve the view (profile) Id for the
linkedViews []
property. - Use the Google Ads Linkscollection to retrieve an Google Ads account Id for the
linkedAdAccounts.linkedAccountId
.- The
linkedAdAccounts[]
property is currently limited to only onelinkedForeignAccount
. - The
linkedAdAccounts[].type
can be set toADWORDS_LINKS
,DBM_LINKS
,MCC_LINKS
orOPTIMIZE
.
- The
- Use the Segments collection for options to set the
segment
property of theincludeConditions
, and if creating a state based audience do the same for theexcludeConditions
. Also see the segments reference for defining a segment.includeConditions
can optionally have values formembershipDurationDays
anddaysToLookBack
excludeConditions.exclusionDuration
can optionally be set toPERMANENT
.
- Execute the
insert
method of the Remarketing Audience resource.
The API allows you to create two types of audiences: SIMPLE
and STATE_BASED
. For 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 thelist
and select the audience you wish to update. - Update any of the writable fields and call
update
passing in the updated audience object.