Audience
Represents the audience in an Experience Builder site. An audience consists of different types of criteria, where the audience can be assigned and used for targeting in a site.
This type extends Metadata and inherits its fields.
Audience components have the suffix .audience and are stored in the audience folder.
Introduced in API version 44.0.
Access to the Audience type requires the AudienceMetadata permission. This permission is on by default for orgs that have Networks enabled.
Access to permission criteria for the Audience type requires the AudiencePermissionCriteria permission. This permission is available in API version 45.0 and later and is on by default for orgs that have Networks enabled.
- Type: string
- Required: Yes
- Description: Required. The name of the audience.
- Type: string
- Required: Yes
- Description: Required. The name of the site or org that contains the audience.
- Type: AudienceCriteria
- Required: Yes
- Introduced: API version 47.0
- Description: Required. Criteria in an audience.
-
Type: AudienceCriterion[]
-
Required: No
-
Description: Removed. List of criteria in an audience.
This field is available in API version 44.0–46.0. In API version 47.0 and later, use
criteriainstead.
- Type: string
- Required: No
- Description: The description of the audience.
- Type: string
- Required: No
- Introduced: API version 45.0
- Description: Formula used to determine the audience.
- Type: FormulaFilterType (enumeration of type string)
- Required: No
- Description: Indicates the audience’s formula type.
- Possible values:
- AllCriteriaMatch
- AnyCriterionMatches
- CustomLogicMatches — (available in API version 45.0 and later)
-
Type: boolean
-
Required: No
-
Description: Indicates whether the audience is the default audience (
true) or not (false). This field is available and required in API version 48.0. In API version 49.0 and later, this field is optional.The default audience file name is of format
Default_Network Name.audience.
- Type: PersonalizationTargetInfos
- Required: No
- Introduced: API version 47.0
- Description: Targets for the audience.
Represents criteria for an audience. This subtype is available in API version 47.0 and later.
- Type: AudienceCriterion[]
- Required: No
- Description: List of criteria for an audience. An audience can have up to 100 criteria.
Represents the value of a criterion in an audience. For a list of AudienceCriteriaValue fields that you can use with each AudienceCriterion type field value, see this table.
- Type: string
- Required: No
- Introduced: API version 53.0
- Description: Developer name of the audience. You can use this field only when the value of the AudienceCriterion
typefield isAudience.
- Type: string
- Required: No
- Description: City of a user. You can use this field only when the value of the AudienceCriterion
typefield isGeoLocation.
- Type: string
- Required: No
- Description: Country of a user. You can use this field only when the value of the AudienceCriterion
typefield isGeoLocation.
- Type: string
- Required: No
- Description: Domain of a user. You can use this field only when the value of the AudienceCriterion
typefield isDomain.
- Type: string
- Required: No
- Description: Field of an object. You can use this field only when the value of the AudienceCriterion
typefield isFieldBased.
- Type: string
- Required: No
- Description: Type of object. You can use this field only when the value of the AudienceCriterion
typefield isFieldBased.
- Type: string
- Required: No
- Description: Value of a field. You can use this field only when the value of the AudienceCriterion
typefield isFieldBased.
- Type: string
- Required: No
- Introduced: API version 45.0
- Description: Indicates whether the permission is enabled (
true) or not (false) for a user. You can use this field used only when the value of the AudienceCriteriontypefield isPermission.
- Type: string
- Required: No
- Introduced: API version 45.0
- Description: Valid API name of a standard user or custom permission. You can use this field only when the value of the AudienceCriterion
typefield isPermission.
- Type: string
- Required: No
- Introduced: API version 45.0
- Description: Type of permission. Valid values are
StandardandCustom. You can use this field only when the value of the AudienceCriteriontypefield isPermission.
- Type: string
- Required: No
- Description: Profile of a user. You can use this field only when the value of the AudienceCriterion
typefield isProfile.
- Type: string
- Required: No
- Description: Subdivision of a user. You can use this field only when the value of the AudienceCriterion
typefield isGeoLocation.
This table summarizes which AudienceCriteriaValue fields you can use with the different AudienceCriterion type field values.
| AudienceCriterion Type | AudienceCriteriaValue Fields |
|---|---|
GeoLocation | citycountrysubdivision |
Domain | domain |
Profile | profile |
FieldBased | entityFieldentityTypefieldValue |
Permission | isEnabledpermissionNamepermissionType |
Audience | audienceDeveloperName |
Represents a criterion for an audience.
- Type: int
- Required: No
- Introduced: API version 45.0
- Description: The number associated with the criterion in a formula, for example (1 AND 2) OR 3.
- Type: AudienceCriteriaValue
- Required: No
- Description: The value of the criterion.
- Type: AudienceCriterionOperator (enumeration of type string)
- Required: No
- Description: The operator associated with this criterion.
- Possible values:
- Equal
- NotEqual
- GreaterThan
- GreaterThanOrEqual
- LessThan
- LessThanOrEqual
- Contains
- StartsWith
- Includes — (available in API version 45.0 and later)
- NotIncludes — (available in API version 45.0 and later)
- Type: AudienceCriterionType (enumeration of type string)
- Required: Yes
- Description: Required. For a list of AudienceCriteriaValue fields that you can use with each AudienceCriterion
typefield value, see this table. - Possible values:
- GeoLocation
- Domain
- Profile
- FieldBased
- Permission — (available in API version 45.0 and later)
- Default — (available in API version 47.0 and later)
- Audience — (available in API version 53.0 and later)
Represents a target for an audience. This subtype is available in API version 47.0 and later.
-
Type: string
-
Required: Yes
-
Description: Required. Group name of the target. Groups bundle related target and audience pairs. You can have up to 2,000 groups and 500 targets per group.
To determine the target group name, see Communities dev personalization names in the Experience Cloud Developer Guide.
- Type: int
- Required: No
- Description: Priority of the target. Within a group, priority determines which target is returned when the user matches more than one audience.
-
Type: string (enumeration of type string)
-
Required: Yes
-
Description: Required. Type of target, indicating the nature of the data being targeted. Supported values include:
You can have up to 2,500
ExperienceVariationtargets and 25,000 record targets.For more information on the
ExperienceVariationtarget type, see ExperienceBundle. -
Possible values:
- ExperienceVariation — (API version 47.0 and later)
- NavigationLinkSet — (API version 49.0 and later)
- Report — (API version 49.0 and later)
- Dashboard — (API version 49.0 and later)
-
Type: string
-
Required: Yes
-
Description: Required. Value of the target, which is the developer name of the experience variation, such as
ContactSupport_ContactSupportForCalifornia_Pagefor a page variation.To determine the target developer name, see Communities dev personalization names in the Experience Cloud Developer Guide.
Represents targets for an audience. This subtype is available in API version 47.0 and later.
When deploying an audience, you must include ExperienceBundle in your package to support experience variation targets.
- Type: PersonalizationTargetInfo[]
- Required: No
- Description: List of targets for an audience.
The following is an example of an Audience component.
You can’t use Metadata API to delete an audience.
In API version 47.0 and later, you can’t create an audience without criteria.
The list of targets provided in the input for an audience is considered the state of target assignments that you want. For example, see the following information for deleting, creating, and updating targets.
If you don’t have a default audience, updating targets can result in the UI erroneously showing a target assigned to the default audience. The target assignment data in the API is correct. To work around the UI issue, temporarily assign another target to the default audience and then delete it.
Personalization using audience targeting varies what the user can see in the browser but doesn’t secure data in any way. To prevent users accessing sensitive data, use standard Salesforce security features, such as sharing rules and permission sets.
- Delete targets: To delete a single target from an audience, deploy the entire list of targets for the audience minus the one that you want to delete.
To delete all the targets from an audience, deploy the audience with empty targets tags. For example:
- Update an audience without updating targets: To update an audience without updating targets, deploy the audience without targets tags. For example:
- Create targets: To create a target, deploy the entire list of targets for the audience plus the one that you want to create.
- Update the priority of a target: To change the priority of a target within an audience, deploy the entire list of targets for the audience with the new priority values for the targets.
To change the priority of a target that affects priority in another audience, deploy both audiences with their entire list of targets with the new priority values for the targets.
- Update the target assignment for an audience: To reassign a target to a new audience, deploy both audiences with their entire list of targets. Deploy one list with the target removed, and the other list with the target added.
This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.