Analytics API
The Analytics API lets you obtain the same analytics data visible in the AWS QuickSight dashboards in a CSV format. Examples of how you can use this data include the following:
- Gain insights about Alexa performance in your properties, such as learning which rooms are the most active.
- Merge the data with your own property-specific information to discern new insights. For example, learn that a resident's satisfaction has increased after placing calls to family with Alexa.
- Provide data to your stakeholders, either through custom reports or by surfacing through your own web interface.
For details about viewing analytics in the developer console, see View Analytics in the Alexa Smart Properties Console.
About the available data
The Analytics API can obtain historic data for the past 90 days, either through a date range, or daily. You can select custom categories of data to retrieve. For example, you can exclude data relevant to proactive campaigns if you don't have multimodal devices.
You can request data for a specific unit, or for all children of a parent unit. This includes the organization unit, so you can get data for all units in your organization.
After you send a request, the API schedules the request to run immediately, and then delivers the result to an S3 bucket that you provide.
Prerequisites
To use the Analytics API, you must have the following:
-
An Alexa Smart Properties (ASP) property on the Alexa for Properties (A4P) tech stack. This includes the Senior Living, Healthcare, and Core subscriptions.
Hospitality subscriptions are now offered in the A4P tech stack. Reach out to your Solution Architect to confirm you're on the A4P tech stack if you use the Hospitality subscription.
-
An Amazon Web Services (AWS) account with an S3 Bucket. Configure the S3 bucket to have the following policy attached under Bucket Policy on the Permissions tab and replace the Resource with your ARN.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "Statement1", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::889066238466:role/AlexaAnalyticsReportConsumerS3IamRole" }, "Action": "s3:PutObject", "Resource": "**<REPLACE WITH S3 BUCKET ARN>**/*" } ] }
- An ASP property containing units. The property and units must be at least four days old.
- A Login with Amazon (LWA) access token with ownership to the units that are being requested.
API endpoint
The endpoint of the Analytics API is https://api.amazonalexa.com
.
Authentication
Each API request must have an authorization header whose value is the access token retrieved from Login with Amazon (LWA).
Operations
The Analytics API includes the following operations.
Operation | HTTP method and URI |
---|---|
|
Generate report
Generate a CSV file with the requested data and save it to a configured S3 bucket.
Amazon recommends that you minimize the amount of time that the generated CSV files remain your S3 bucket and delete these files as soon as possible.
Request
To generate a report, you make a POST
request to /v1/enterprise/analytics/reports
.
This operation is available in the following countries.
Healthcare | Hospitality (A4P) | Senior Living | Core |
---|---|---|---|
US, CA |
US, CA |
US, CA |
US, CA |
Request path and header example
POST /v1/enterprise/analytics/reports
Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Header |
String |
Yes |
Request body example
{
"unitId": "amzn1.alexa.unit.did.xxxx",
"categories": [
"DEVICE"
],
"dateRange": {
"startDate": "2023-06-01",
"endDate": "2023-06-02",
"granularity": "DAILY"
},
"format": "CSV",
"showSubUnits": true,
"deliveryChannel": {
"id": "arn:aws:s3:::<bucket id>",
"type": "S3"
}
}
Request body properties
Field | Description | Type | Required |
---|---|---|---|
|
Directed ID of a unit in the hierarchy in the format |
String |
Yes |
|
An array of enumerations that specify the type of data to deliver in the report. |
Array of enumeration values |
Yes |
|
Encapsulates information about the dates the report should cover. |
Object |
Yes |
|
The earliest date to retrieve data for, inclusive, in the format |
String |
Yes |
|
The latest date to retrieve data for, inclusive, in the format |
String |
Yes |
|
Indicates whether to roll up the data for the specified time range.
For example, assume the report contains three days of data for two units (
|
Enumeration: |
Yes |
|
The output file type for the report. |
Enumeration: |
Yes |
|
When true, the report includes a row for each descendent in the hierarchy. When For example, assume the report contains two days of data for three units in a tree structure with
|
Boolean |
Yes |
|
Encapsulates information about how to deliver the output report. |
Object |
Yes |
|
Specifies to deliver the report. |
Enumeration: |
Yes |
|
Identifier for the output report delivery location. Max length of 255 characters. When |
String |
No |
Response
A successful response returns HTTP 202 Accepted
with information about the expected report outputs. On error, the response returns the appropriate HTTP status code and includes a response body with an error code and human readable message
Response body example
{
"message": "The report generation has been queued. Results with the attached names will be delivered when complete.",
"reports": [
{
"category": "<configuration.categories ENUM value, ex: DEVICE>",
"name": "<output-report-filename-n.csv>"
}
]
}
Response headers
Property | Description | Type |
---|---|---|
|
Contains |
String |
|
A UUID generated for the individual request. |
String |
Response body properties
Property | Description | Type |
---|---|---|
|
A generic success or failure message |
String |
|
An array of objects with information about the expected output reports. If an error occurs, the |
Array |
|
Name of the corresponding category for this report. |
String |
|
Name of an output report. Reports are generated asynchronously based on the request. |
String |
|
Array of problems encountered during processing. Included when an error occurs. |
Array |
|
A short message explaining the error. |
String |
|
An ID to reference documentation for more information about the error. |
String |
|
HTTP Response code for the type of error encountered. |
int |
HTTP status codes
Status | Description |
---|---|
|
The request was successful. Reports are generated asynchronously and are available at the specified |
|
Indicates that one or more properties in the request body aren't valid. The following example shows the response body with the error and message.
|
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
API exceeded the permitted rate limit or specified number of requests per unit of time. Requests can be retried using exponential back-off. |
|
Error occurred on the server. The request can be retried using exponential back-off. |
|
Data not yet available due to an upstream processing delay. Amazon recommends that you retry every few hours while we work to resolve the delay. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
The following code shows the JSON format of an error.
{
"message": "There was an error processing the request.",
"reports": [], // no reports are delivered if there are any errors during processing
"errors": [
{
"errorDescription": "<description of the failure>",
"errorCode": "<more specific error code to reference in documentation>",
"status": <HTTP status code related to the error>
}
]
}
Sample generated reports
The following table shows an example of the output for DEVICE
data over a specific time range.
dataset_date | unitId_level_1 | unitName_level_1 | unitId_level_2 | unitName_level_2 | unitId_level_3 | unitName_level_3 | device_count | active_device_count | dialog_count |
---|---|---|---|---|---|---|---|---|---|
8/15/2023 | amzn1.alexa.unit.did.XXX | Test Healthcare | amzn1.alexa.unit.did.YYY | Default | amzn1.alexa.unit.did.ZZZ | Test Room | 1 | 0 | 0 |
8/16/2023 | amzn1.alexa.unit.did.XXX | Test Healthcare | amzn1.alexa.unit.did.YYY | Default | amzn1.alexa.unit.did.ZZZ | Test Room | 1 | 0 | 0 |
8/17/2023 | amzn1.alexa.unit.did.XXX | Test Healthcare | amzn1.alexa.unit.did.YYY | Default | amzn1.alexa.unit.did.ZZZ | Test Room | 1 | 0 | 0 |
8/19/2023 | amzn1.alexa.unit.did.XXX | Test Healthcare | amzn1.alexa.unit.did.YYY | Default | amzn1.alexa.unit.did.ZZZ | Test Room | 1 | 0 | 0 |
8/20/2023 | amzn1.alexa.unit.did.XXX | Test Healthcare | amzn1.alexa.unit.did.YYY | Default | amzn1.alexa.unit.did.ZZZ | Test Room | 1 | 0 | 0 |
8/21/2023 | amzn1.alexa.unit.did.XXX | Test Healthcare | amzn1.alexa.unit.did.YYY | Default | amzn1.alexa.unit.did.ZZZ | Test Room | 1 | 0 | 0 |
8/22/2023 | amzn1.alexa.unit.did.XXX | Test Healthcare | amzn1.alexa.unit.did.YYY | Default | amzn1.alexa.unit.did.ZZZ | Test Room | 1 | 0 | 0 |
The following table shows an example of the output for DOMAIN_ENGAGEMENT
data for a specific time range.
dataset_date | unitId_level_0 | unitName_level_0 | unitId_level_1 | unitName_level_1 | Business Domain | active_device_count | dialog_count |
---|---|---|---|---|---|---|---|
8/16/2023 | amzn1.alexa.unit.did.XXX | Test Org | amzn1.alexa.unit.did.YYY | Test Healthcare | Audio | 12 | 46 |
8/17/2023 | amzn1.alexa.unit.did.XXX | Test Org | amzn1.alexa.unit.did.YYY | Test Healthcare | Other | 2 | 3 |
The following table shows an example of the output for PROACTIVE_CAMPAIGN
data for a specific time range.
dataset_date | unitId_level_0 | unitName_level_0 | unitId_level_1 | unitName_level_1 | campaign_id | targeted_devices_count | taps_count | impression_count |
---|---|---|---|---|---|---|---|---|
9/3/2023 | amzn1.alexa.unit.did.XXX | Test Org | amzn1.alexa.unit.did.YYY | Test Healthcare | XXX | 1 | 4 | 100 |
The following table shows an example of the output for PROPERTY_SKILL
data for a specific time range.
dataset_date | unitId_level_0 | unitName_level_0 | unitId_level_1 | unitName_level_1 | skill_name | intent_name | active_device_count | dialog_count |
---|---|---|---|---|---|---|---|---|
9/3/2023 | amzn1.alexa.unit.did.XXX | Test Org | amzn1.alexa.unit.did.YYY | Test Healthcare | My Property Skill | GetMenu | 1 | 1 |
The following table shows an example of the output for COMMUNICATION
data for a specific time range.
dataset_date | unitId_level_0 | unitName_level_0 | unitId_level_1 | unitName_level_1 | direction | sub_experience | call_provider | calling_action_count | calling_duration_minutes | dropIn_action_count | dropIn_duration_minutes |
---|---|---|---|---|---|---|---|---|---|---|---|
9/3/2023 | amzn1.alexa.unit.did.XXX | Test Org | amzn1.alexa.unit.did.YYY | Test Healthcare | Inbound | DropIn_Video | A2A | 0 | 0 | 1 | 164.33 |
9/3/2023 | amzn1.alexa.unit.did.XXX | Test Org | amzn1.alexa.unit.did.YYY | Test Healthcare | Outbound | Calling_Voice | PSTN | 99 | 157.95 | 0 | 0 |
Related topics
- Get Started with Alexa Smart Properties APIs
- View Analytics in the Alexa Smart Properties Console
- REST API Reference
- About Alexa Smart Properties
Last updated: Nov 28, 2023