Search Ads 360 Reporting API . customers . audiences

Instance Methods

close()

Close httplib2 connections.

mutate(customerId, body=None, x__xgafv=None)

Creates audiences. Operation statuses are returned. List of thrown errors: [AudienceError]()

Method Details

close()
Close httplib2 connections.
mutate(customerId, body=None, x__xgafv=None)
Creates audiences. Operation statuses are returned. List of thrown errors: [AudienceError]()

Args:
  customerId: string, Required. The ID of the customer whose audiences are being modified. (required)
  body: object, The request body.
    The object takes the form of:

{ # Request message for AudienceService.MutateAudiences.
  "operations": [ # Required. The list of operations to perform on individual audiences.
    { # A single operation (create, update) on an audience.
      "create": { # Audience is an effective targeting option that lets you intersect different segment attributes, such as detailed demographics and affinities, to create audiences that represent sections of your target segments. # Create operation: No resource name is expected for the new audience
        "assetGroup": "A String", # Immutable. The asset group that this audience is scoped under. Must be set if and only if scope is ASSET_GROUP. Immutable after creation. If an audience with ASSET_GROUP scope is upgraded to CUSTOMER scope, this field will automatically be cleared.
        "description": "A String", # Description of this audience.
        "dimensions": [ # Positive dimensions specifying the audience composition.
          { # Positive dimension specifying user's audience.
            "age": { # Dimension specifying users by their age. # Dimension specifying users by their age.
              "ageRanges": [ # Contiguous age range to be included in the dimension.
                { # Contiguous age range.
                  "maxAge": 42, # Maximum age to include. A maximum age need not be specified. If specified, max_age must be greater than min_age, and allowed values are 24, 34, 44, 54, and 64.
                  "minAge": 42, # Minimum age to include. A minimum age must be specified and must be at least 18. Allowed values are 18, 25, 35, 45, 55, and 65.
                },
              ],
              "includeUndetermined": True or False, # Include users whose age is not determined.
            },
            "audienceSegments": { # Dimension specifying users by their membership in other audience segments. # Dimension specifying users by their membership in other audience segments.
              "segments": [ # Included audience segments. Users are included if they belong to at least one segment.
                { # Positive audience segment.
                  "customAudience": { # Custom audience segment. # Custom audience segment.
                    "customAudience": "A String", # The custom audience resource.
                  },
                  "detailedDemographic": { # Detailed demographic segment. # Detailed demographic segment.
                    "detailedDemographic": "A String", # The detailed demographic resource.
                  },
                  "lifeEvent": { # Live event segment. # Live-event audience segment.
                    "lifeEvent": "A String", # The life event resource.
                  },
                  "userInterest": { # User interest segment. # Affinity or In-market segment.
                    "userInterestCategory": "A String", # The user interest resource.
                  },
                  "userList": { # User list segment. # User list segment.
                    "userList": "A String", # The user list resource.
                  },
                },
              ],
            },
            "gender": { # Dimension specifying users by their gender. # Dimension specifying users by their gender.
              "genders": [ # Included gender demographic segments.
                "A String",
              ],
              "includeUndetermined": True or False, # Include users whose gender is not determined.
            },
            "householdIncome": { # Dimension specifying users by their household income. # Dimension specifying users by their household income.
              "includeUndetermined": True or False, # Include users whose household income is not determined.
              "incomeRanges": [ # Included household income demographic segments.
                "A String",
              ],
            },
            "parentalStatus": { # Dimension specifying users by their parental status. # Dimension specifying users by their parental status.
              "includeUndetermined": True or False, # Include users whose parental status is undetermined.
              "parentalStatuses": [ # Included parental status demographic segments.
                "A String",
              ],
            },
          },
        ],
        "exclusionDimension": { # Negative dimension specifying users to exclude from the audience. # Negative dimension specifying the audience composition.
          "exclusions": [ # Audience segment to be excluded.
            { # An audience segment to be excluded from an audience.
              "userList": { # User list segment. # User list segment to be excluded.
                "userList": "A String", # The user list resource.
              },
            },
          ],
        },
        "id": "A String", # Output only. ID of the audience.
        "name": "A String", # Name of the audience. It should be unique across all audiences within the account. It must have a minimum length of 1 and maximum length of 255. Required when scope is not set or is set to CUSTOMER. Cannot be set or updated when scope is ASSET_GROUP.
        "resourceName": "A String", # Immutable. The resource name of the audience. Audience names have the form: `customers/{customer_id}/audiences/{audience_id}`
        "scope": "A String", # Defines the scope this audience can be used in. By default, the scope is CUSTOMER. Audiences can be created with a scope of ASSET_GROUP for exclusive use by a single asset_group. Scope may change from ASSET_GROUP to CUSTOMER but not from CUSTOMER to ASSET_GROUP.
        "status": "A String", # Output only. Status of this audience. Indicates whether the audience is enabled or removed.
      },
      "update": { # Audience is an effective targeting option that lets you intersect different segment attributes, such as detailed demographics and affinities, to create audiences that represent sections of your target segments. # Update operation: The audience is expected to have a valid resource name.
        "assetGroup": "A String", # Immutable. The asset group that this audience is scoped under. Must be set if and only if scope is ASSET_GROUP. Immutable after creation. If an audience with ASSET_GROUP scope is upgraded to CUSTOMER scope, this field will automatically be cleared.
        "description": "A String", # Description of this audience.
        "dimensions": [ # Positive dimensions specifying the audience composition.
          { # Positive dimension specifying user's audience.
            "age": { # Dimension specifying users by their age. # Dimension specifying users by their age.
              "ageRanges": [ # Contiguous age range to be included in the dimension.
                { # Contiguous age range.
                  "maxAge": 42, # Maximum age to include. A maximum age need not be specified. If specified, max_age must be greater than min_age, and allowed values are 24, 34, 44, 54, and 64.
                  "minAge": 42, # Minimum age to include. A minimum age must be specified and must be at least 18. Allowed values are 18, 25, 35, 45, 55, and 65.
                },
              ],
              "includeUndetermined": True or False, # Include users whose age is not determined.
            },
            "audienceSegments": { # Dimension specifying users by their membership in other audience segments. # Dimension specifying users by their membership in other audience segments.
              "segments": [ # Included audience segments. Users are included if they belong to at least one segment.
                { # Positive audience segment.
                  "customAudience": { # Custom audience segment. # Custom audience segment.
                    "customAudience": "A String", # The custom audience resource.
                  },
                  "detailedDemographic": { # Detailed demographic segment. # Detailed demographic segment.
                    "detailedDemographic": "A String", # The detailed demographic resource.
                  },
                  "lifeEvent": { # Live event segment. # Live-event audience segment.
                    "lifeEvent": "A String", # The life event resource.
                  },
                  "userInterest": { # User interest segment. # Affinity or In-market segment.
                    "userInterestCategory": "A String", # The user interest resource.
                  },
                  "userList": { # User list segment. # User list segment.
                    "userList": "A String", # The user list resource.
                  },
                },
              ],
            },
            "gender": { # Dimension specifying users by their gender. # Dimension specifying users by their gender.
              "genders": [ # Included gender demographic segments.
                "A String",
              ],
              "includeUndetermined": True or False, # Include users whose gender is not determined.
            },
            "householdIncome": { # Dimension specifying users by their household income. # Dimension specifying users by their household income.
              "includeUndetermined": True or False, # Include users whose household income is not determined.
              "incomeRanges": [ # Included household income demographic segments.
                "A String",
              ],
            },
            "parentalStatus": { # Dimension specifying users by their parental status. # Dimension specifying users by their parental status.
              "includeUndetermined": True or False, # Include users whose parental status is undetermined.
              "parentalStatuses": [ # Included parental status demographic segments.
                "A String",
              ],
            },
          },
        ],
        "exclusionDimension": { # Negative dimension specifying users to exclude from the audience. # Negative dimension specifying the audience composition.
          "exclusions": [ # Audience segment to be excluded.
            { # An audience segment to be excluded from an audience.
              "userList": { # User list segment. # User list segment to be excluded.
                "userList": "A String", # The user list resource.
              },
            },
          ],
        },
        "id": "A String", # Output only. ID of the audience.
        "name": "A String", # Name of the audience. It should be unique across all audiences within the account. It must have a minimum length of 1 and maximum length of 255. Required when scope is not set or is set to CUSTOMER. Cannot be set or updated when scope is ASSET_GROUP.
        "resourceName": "A String", # Immutable. The resource name of the audience. Audience names have the form: `customers/{customer_id}/audiences/{audience_id}`
        "scope": "A String", # Defines the scope this audience can be used in. By default, the scope is CUSTOMER. Audiences can be created with a scope of ASSET_GROUP for exclusive use by a single asset_group. Scope may change from ASSET_GROUP to CUSTOMER but not from CUSTOMER to ASSET_GROUP.
        "status": "A String", # Output only. Status of this audience. Indicates whether the audience is enabled or removed.
      },
      "updateMask": "A String", # FieldMask that determines which resource fields are modified in an update.
    },
  ],
  "partialFailure": True or False, # If true, successful operations will be carried out and invalid operations will return errors. If false, all operations will be carried out in one transaction if and only if they are all valid. Default is false.
  "responseContentType": "A String", # The response content type setting. Determines whether the mutable resource or just the resource name should be returned post mutation.
  "validateOnly": True or False, # If true, the request is validated but not executed. Only errors are returned, not results.
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response message for an audience mutate.
  "partialFailureError": { # The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). # Errors that pertain to operation failures in the partial failure mode. Returned only when partial_failure = true and all errors occur inside the operations. If any errors occur outside the operations (for example, auth errors), we return an RPC level error.
    "code": 42, # The status code, which should be an enum value of google.rpc.Code.
    "details": [ # A list of messages that carry the error details. There is a common set of message types for APIs to use.
      {
        "a_key": "", # Properties of the object. Contains field @type with type URL.
      },
    ],
    "message": "A String", # A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
  },
  "results": [ # All results for the mutate.
    { # The result for the audience mutate.
      "audience": { # Audience is an effective targeting option that lets you intersect different segment attributes, such as detailed demographics and affinities, to create audiences that represent sections of your target segments. # The mutated Audience with only mutable fields after mutate. The field will only be returned when response_content_type is set to "MUTABLE_RESOURCE".
        "assetGroup": "A String", # Immutable. The asset group that this audience is scoped under. Must be set if and only if scope is ASSET_GROUP. Immutable after creation. If an audience with ASSET_GROUP scope is upgraded to CUSTOMER scope, this field will automatically be cleared.
        "description": "A String", # Description of this audience.
        "dimensions": [ # Positive dimensions specifying the audience composition.
          { # Positive dimension specifying user's audience.
            "age": { # Dimension specifying users by their age. # Dimension specifying users by their age.
              "ageRanges": [ # Contiguous age range to be included in the dimension.
                { # Contiguous age range.
                  "maxAge": 42, # Maximum age to include. A maximum age need not be specified. If specified, max_age must be greater than min_age, and allowed values are 24, 34, 44, 54, and 64.
                  "minAge": 42, # Minimum age to include. A minimum age must be specified and must be at least 18. Allowed values are 18, 25, 35, 45, 55, and 65.
                },
              ],
              "includeUndetermined": True or False, # Include users whose age is not determined.
            },
            "audienceSegments": { # Dimension specifying users by their membership in other audience segments. # Dimension specifying users by their membership in other audience segments.
              "segments": [ # Included audience segments. Users are included if they belong to at least one segment.
                { # Positive audience segment.
                  "customAudience": { # Custom audience segment. # Custom audience segment.
                    "customAudience": "A String", # The custom audience resource.
                  },
                  "detailedDemographic": { # Detailed demographic segment. # Detailed demographic segment.
                    "detailedDemographic": "A String", # The detailed demographic resource.
                  },
                  "lifeEvent": { # Live event segment. # Live-event audience segment.
                    "lifeEvent": "A String", # The life event resource.
                  },
                  "userInterest": { # User interest segment. # Affinity or In-market segment.
                    "userInterestCategory": "A String", # The user interest resource.
                  },
                  "userList": { # User list segment. # User list segment.
                    "userList": "A String", # The user list resource.
                  },
                },
              ],
            },
            "gender": { # Dimension specifying users by their gender. # Dimension specifying users by their gender.
              "genders": [ # Included gender demographic segments.
                "A String",
              ],
              "includeUndetermined": True or False, # Include users whose gender is not determined.
            },
            "householdIncome": { # Dimension specifying users by their household income. # Dimension specifying users by their household income.
              "includeUndetermined": True or False, # Include users whose household income is not determined.
              "incomeRanges": [ # Included household income demographic segments.
                "A String",
              ],
            },
            "parentalStatus": { # Dimension specifying users by their parental status. # Dimension specifying users by their parental status.
              "includeUndetermined": True or False, # Include users whose parental status is undetermined.
              "parentalStatuses": [ # Included parental status demographic segments.
                "A String",
              ],
            },
          },
        ],
        "exclusionDimension": { # Negative dimension specifying users to exclude from the audience. # Negative dimension specifying the audience composition.
          "exclusions": [ # Audience segment to be excluded.
            { # An audience segment to be excluded from an audience.
              "userList": { # User list segment. # User list segment to be excluded.
                "userList": "A String", # The user list resource.
              },
            },
          ],
        },
        "id": "A String", # Output only. ID of the audience.
        "name": "A String", # Name of the audience. It should be unique across all audiences within the account. It must have a minimum length of 1 and maximum length of 255. Required when scope is not set or is set to CUSTOMER. Cannot be set or updated when scope is ASSET_GROUP.
        "resourceName": "A String", # Immutable. The resource name of the audience. Audience names have the form: `customers/{customer_id}/audiences/{audience_id}`
        "scope": "A String", # Defines the scope this audience can be used in. By default, the scope is CUSTOMER. Audiences can be created with a scope of ASSET_GROUP for exclusive use by a single asset_group. Scope may change from ASSET_GROUP to CUSTOMER but not from CUSTOMER to ASSET_GROUP.
        "status": "A String", # Output only. Status of this audience. Indicates whether the audience is enabled or removed.
      },
      "resourceName": "A String", # Returned for successful operations.
    },
  ],
}