Metrics API
The CJA Metrics APIs allow you to retrieve metrics programmatically through Adobe Developer. These APIs use the same data and methods that Adobe uses inside the product UI. See Metrics in the Customer Journey Analytics guide for more information.
The endpoints described in this guide are routed through analytics.adobe.io. To use them, you will need to first create a client with access to Customer Journey Analytics APIs. For more information, refer to Getting started with the Customer Journey Analytics API.
data-variant=info
data-slots=text
This guide includes instructions for using the following endpoints:
- GET multiple metrics: Retrieves a list of metrics for a specified dataview ID
- GET a single metric: Retrieves information for a single metric from a dataview
Retrieve multiple metrics
Use this endpoint to retrieve a single metric for a specified dataview ID.
GET https://cja.adobe.io/data/dataviews/{DATAVIEW_ID}/metrics
Request and response examples
Click the Request tab in the following example to see a cURL request for this endpoint. Click the Response tab to see a successful JSON response for the request.
data-slots=heading, code
data-repeat=2
data-languages=CURL,JSON
Request
curl -X GET "https://cja.adobe.io/data/dataviews/{DATAVIEW_ID}/metrics" \
-H "x-api-key: {CLIENT_ID}" \
-H "x-gw-ims-org-id: {IMS_ORG_ID}" \
-H "Authorization: Bearer {ACCESS_TOKEN}"
Response
{
"content": [
{
"id": "metrics/adobe_firsttimesessions",
"name": "First-time Sessions",
"dataSetType": "event",
"sourceFieldType": "integer",
"hasData": true,
"derivedFieldCompatible": true
},
{
"id": "metrics/adobe_returnsessions",
"name": "Return Sessions",
"dataSetType": "event",
"sourceFieldType": "integer",
"hasData": true,
"derivedFieldCompatible": true
},
{
"id": "metrics/visitors",
"name": "People",
"dataSetType": "event",
"hasData": true,
"derivedFieldCompatible": false
},
{
"id": "metrics/visits",
"name": "Sessions",
"dataSetType": "event",
"hasData": true,
"derivedFieldCompatible": false
},
],
"totalElements": 4,
"totalPages": 1,
"number": 0,
"numberOfElements": 4,
"firstPage": true,
"lastPage": true,
"sort": null,
"size": 4
}
Request example details
The example above shows a request for all metrics of the required dataviewId parameter, as specified in the path.
Response example details
The response example above shows the following names of the four metrics returned for the specified dataview:
- First-time Sessions
- Return Sessions
- People
- Sessions
It also includes the following information:
-
The
dataSetTypefor all four parameters isevent. -
The metric IDs, the value for the
derivedFieldCompatibleparameter, and thehasDatavalue--indicating whether the metric has data associated with it.
Request parameters
The GET multiple metrics endpoints includes one request path parameter (dataviewId) and three optional query parameters, as shown below:
dataviewIdincludeTypelocaleexpansionResponse parameters
The Retrieve multiple metrics endpoint includes the following response parameters:
idnamedescriptionsourceFieldIdsourceFieldNamestorageIddataSetIdsdataSetTypeenum dataset types: EVENT, LOOKUP, or PROFILEschemaTypesourceFieldTypetableNametypeenum of one of the following: string, boolean, int, decimal, currency, percent, time, enum, and ordered_enum.requiredhideFromReportingschemaPathhasDatasegmentablefavoriteapprovedtagsproperty objects that contain data associated with the metric. For example, property1, property2, etc. each contain data in key-value pairs for the metric.sharesproperty objects that contain data associated with the metric. For example, property1, property2, etc. each contain data in key-value pairs for the metric.usageSummaryproperty objects that contain data associated with the metric. For example, property1, property2, etc. each contain data in key-value pairs for the metric.notFoundhiddenfromGlobalLookupmultiValuedincludeExcludeSettingcaseSensitive, match, type, rules and enabled. These settings are described in the following rows.caseSensitiveincludeExcludeSetting response object.matchand, or or (both type enum). This is contained in the includeExcludeSetting response object.typestring, numeric or date (all type enum). This is contained in the includeExcludeSetting response object.rulesstring and value (both type string). This is contained in the includeExcludeSetting response object.enabledincludeExcludeSetting response object.fieldDefinitionfunc, id, field, label, branches, oberon-storage-type, oberon-table, oberon-field, oberon-storage-id, case-sensitive, and mapped-type. These definitions are described in the following rows.funcraw_field, match or floor (all type enum). This is contained in the fieldDefinition response object.idfieldDefinition response object.fieldfieldDefinition. This is contained in the fieldDefinition response object.labelfieldDefinition response object.branchespred and map-to. This is contained in the fieldDefinition response object. For the complete data model on pred objects and parameters, see the CJA Metrics API reference.oberon-storage-typefieldDefinition response object.oberon-tablefieldDefinition response object.oberon-fieldfieldDefinition response object.oberon-storage-idfieldDefinition response object.case-sensitivefieldDefinition is case-sensitive. This is contained in the fieldDefinition response object.mapped-typefieldDefinition response object.countTypeinstances and values.formatSettingpolarity, formatType, decimalPlaces, and currency. For the complete data model on these settings, see the CJA Metrics API reference.attributionSettingenabled, attributionModel, and lookback. For the complete data model on these settings, see the CJA Metrics API reference.precisionisDeletedRetrieve a single metric
You can retrieve details of a single metric if you know the metric ID. You can find the metric ID by using the multiple metrics endpoint, as described above.
Use this endpoint to retrieve a list of metrics for a specified dataview ID.
GET https://cja.adobe.io/data/dataviews/{DATAVIEW_ID}/metrics/{METRIC_ID}
Request and response examples
Click the Request tab in the following example to see a cURL request for this endpoint. Click the Response tab to see a successful JSON response for the request.
data-slots=heading, code
data-repeat=2
data-languages=CURL,JSON
Request
curl -X GET "https://cja.adobe.io/data/dataviews/dv_64c7cf/metrics/visits" \
-H "x-api-key: {CLIENT_ID}" \
-H "x-gw-ims-org-id: {IMS_ORG_ID}" \
-H "Authorization: Bearer {ACCESS_TOKEN}"
Response
{
"id": "metrics/visits",
"name": "Sessions",
"dataSetType": "event",
"hasData": true,
"derivedFieldCompatible": false
}
Request example details
The request example above shows a request for information associated with the visits metric in the dv_64c7cf data view.
Response example details
The example response above shows information for the visits metric in the dv_64c7cf data view, including the following:
- The metric name is
Sessions. - The setting for the metric data type is
event. - The metric has data associated with it, but is not defined as a derived field.
Request parameters
The required request parameters for retrieving a single metric should be specified in the path. The optional parameters should be specified as query parameters.
dataviewIdmetricIdmetrics/ prefix. For example, instead of metrics/visitors, use only visitors for the IDlocaleexpansionResponse parameters
The response parameters for retrieving a single metric are the same as for retrieving multiple metrics. See the table above for a description of each parameter.
API status codes
For a description of API status codes and tips for troubleshooting, see the Platform FAQ and troubleshooting guide.