• AWS SDK for Python
• AWS SDK for Ruby V3
Campaign Metrics
A campaign metric is a measurable value, also referred to as a key performance indicator (KPI), that can help you monitor and assess the performance of a specific campaign. For example, you can use a campaign metric to access data about how many endpoints a campaign message was sent to or how many of those messages were delivered to the intended endpoints. Amazon Pinpoint automatically collects, aggregates, and stores this data for all of your campaigns. If you integrated a mobile app with Amazon Pinpoint by using an AWS Mobile SDK, Amazon Pinpoint extends this support to include additional metrics, such as the percentage of push notifications that were opened by recipients. For information about integrating a mobile app, see Integrating Amazon Pinpoint with Your Application in the Amazon Pinpoint Developer Guide.
The Campaign Metrics resource represents a collection of standard metrics that apply to individual campaigns. As part of the Amazon Pinpoint Analytics APIs, this resource provides you with programmatic access to pre-aggregated data for each of these metrics. For a list of campaign metrics that are currently supported, see the Amazon Pinpoint Developer Guide.
You can use the Campaign Metrics resource to retrieve pre-aggregated data for a standard metric that applies to an individual campaign. To retrieve data for a standard metric that applies to all the campaigns for an application, use the Application Metrics (p. 67) resource.
URI
/v1/apps/application-id/campaigns/campaign-id/kpis/daterange/kpi-name
HTTP methods
GET
Operation ID: GetCampaignDateRangeKpi
Retrieves (queries) pre-aggregated data for a standard metric that applies to a campaign.
Path parameters
Name Type Required Description
application-id String True The unique identifier
for the application. This identifier is displayed as the Project ID on the Amazon Pinpoint console.
kpi-name String True The name of the metric,
also referred to as a key performance indicator (KPI), to retrieve data for. This value describes the associated metric and consists of two
HTTP methods
Name Type Required Description
or more terms, which are comprised of lowercase alphanumeric characters, separated by a hyphen. Examples are email-open-rate and successful-delivery-rate. For a list of valid values, see the Amazon Pinpoint Developer Guide.
campaign-id String True The unique identifier
for the campaign.
Header parameters
Name Type Required Description
accept String False Indicates which content
types, expressed as MIME types, the client understands.
Query parameters
Name Type Required Description
next-token String False The string that
specifies which page of results to return in a paginated response.
This parameter is not supported for application, campaign, and journey metrics.
end-time String False The last date and time
to retrieve data for, as part of an inclusive date range that filters the query results. This value should be in extended ISO 8601 format and use Coordinated Universal Time (UTC), for example:
2019-07-26T20:00:00Z for 8:00 PM UTC July 26, 2019.
start-time String False The first date and time
to retrieve data for, as part of an inclusive date range that filters the
HTTP methods
Name Type Required Description
query results. This value should be in extended ISO 8601 format and use Coordinated Universal Time (UTC), for example:
2019-07-19T20:00:00Z for 8:00 PM UTC July 19, 2019. This value should also be fewer than 90 days from the current day.
page-size String False The maximum number
of items to include in each page of a
Status code Response model Description
200 CampaignDateRangeKpiResponse (p. 149)The request succeeded.
400 MessageBody (p. 149) The request contains a syntax
error (BadRequestException).
403 MessageBody (p. 149) The request was denied
because access to the
specified resource is forbidden (ForbiddenException).
404 MessageBody (p. 149) The request failed because the
specified resource was not found (NotFoundException).
405 MessageBody (p. 149) The request failed because
the method is not allowed for the specified resource (MethodNotAllowedException).
413 MessageBody (p. 149) The request failed because
the payload for the body of the request is too large
(RequestEntityTooLargeException).
429 MessageBody (p. 149) The request failed because
too many requests were sent during a certain amount of time (TooManyRequestsException).
500 MessageBody (p. 149) The request failed due to
an unknown internal server
Schemas
Status code Response model Description
error, exception, or failure (InternalServerErrorException).
OPTIONS
Retrieves information about the communication requirements and options that are available for the Campaign Metrics resource.
Path parameters
Name Type Required Description
campaign-id String True The unique identifier
for the campaign.
application-id String True The unique identifier
for the application. This identifier is displayed as the Project ID on the Amazon Pinpoint console.
kpi-name String True The name of the metric,
also referred to as a key performance indicator (KPI), to retrieve data for. This value describes the associated metric and consists of two or more terms, which are comprised of lowercase alphanumeric characters, separated by a hyphen. Examples are email-open-rate and successful-delivery-rate. For a list of valid values, see the Amazon Pinpoint Developer Guide.
Responses
Status code Response model Description
200 None The request succeeded.
Schemas
Response bodies
Properties
CampaignDateRangeKpiResponse schema
{
"KpiName": "string", "KpiResult": { "Rows": [
}, "NextToken": "string", "ApplicationId": "string", "CampaignId": "string", "StartTime": "string", "EndTime": "string"
}
MessageBody schema
{
"RequestID": "string", "Message": "string"
}
Properties
BaseKpiResult
Provides the results of a query that retrieved the data for a standard metric that applies to an application, campaign, or journey.
Rows
An array of objects that provides the results of a query that retrieved the data for a standard metric that applies to an application, campaign, or journey.
Type: Array of type ResultRow (p. 151) Required: True
CampaignDateRangeKpiResponse
Provides the results of a query that retrieved the data for a standard metric that applies to a campaign, and provides information about that query.
Properties
KpiName
The name of the metric, also referred to as a key performance indicator (KPI), that the data was retrieved for. This value describes the associated metric and consists of two or more terms, which are comprised of lowercase alphanumeric characters, separated by a hyphen. For a list of possible values, see the Amazon Pinpoint Developer Guide.
Type: string Required: True
KpiResult
An array of objects that contains the results of the query. Each object contains the value for the metric and metadata about that value.
Type: BaseKpiResult (p. 149) Required: True
NextToken
The string to use in a subsequent request to get the next page of results in a paginated response. This value is null for the Campaign Metrics resource because the resource returns all results in a single page.
Type: string Required: False
ApplicationId
The unique identifier for the application that the metric applies to.
Type: string Required: True
CampaignId
The unique identifier for the campaign that the metric applies to.
Type: string Required: True
StartTime
The first date and time of the date range that was used to filter the query results, in extended ISO 8601 format. The date range is inclusive.
Type: string Required: True
EndTime
The last date and time of the date range that was used to filter the query results, in extended ISO 8601 format. The date range is inclusive.
Type: string
Properties
Required: True
MessageBody
Provides information about an API request or response.
RequestID
The unique identifier for the request or response.
Type: string Required: False
Message
The message that's returned from the API.
Type: string Required: False
ResultRow
Provides the results of a query that retrieved the data for a standard metric that applies to an application, campaign, or journey.
GroupedBys
An array of objects that defines the field and field values that were used to group data in a result set that contains multiple results. This value is null if the data in a result set isn’t grouped.
Type: Array of type ResultRowValue (p. 151) Required: True
Values
An array of objects that provides pre-aggregated values for a standard metric that applies to an application, campaign, or journey.
Type: Array of type ResultRowValue (p. 151) Required: True
ResultRowValue
Provides a single value and metadata about that value as part of an array of query results for a standard metric that applies to an application, campaign, or journey.
Key
The friendly name of the metric whose value is specified by the Value property.
Type: string Required: True
See also
Value
In a Values object, the value for the metric that the query retrieved data for. In a GroupedBys object, the value for the field that was used to group data in a result set that contains multiple results (Values objects).
Type: string Required: True
Type
The data type of the value specified by the Value property.
Type: string Required: True
See also
For more information about using this API in one of the language-specific AWS SDKs and references, see the following:
GetCampaignDateRangeKpi
• AWS Command Line Interface
• AWS SDK for .NET
• AWS SDK for C++
• AWS SDK for Go
• AWS SDK for Java V2
• AWS SDK for JavaScript
• AWS SDK for PHP V3
• AWS SDK for Python
• AWS SDK for Ruby V3