Edit in GitHubLog an issue

Calculated metrics

The Calculated metrics APIs allow you to retrieve, update, or create calculated metrics programmatically through Adobe Developer. The APIs use the same data and methods that are used when working with calculated metrics in the UI. See Calculated metrics overview in the CJA documentation for more information.

You can call the /calculatedmetrics/ endpoint to add, edit or delete calculated metrics.

Retrieve a list of calculated metrics

In CJA, you can navigate to Components > Calculated metrics and see a list of calculated metrics that you created or others have shared. This call is helpful to identify the ID's of desired calculated metrics.

GET https://cja.adobe.io/calculatedmetrics

For example, get a response of all calculated metrics shared with the user.

Copied to your clipboard
curl -X GET "https://cja.adobe.io/calculatedmetrics?includeType=shared" \
-H "x-api-key: {CLIENTID}" \
-H "x-gw-ims-org-id: {IMSORG}" \
-H "Authorization: Bearer {ACCESSTOKEN}"

Retrieve a single calculated metric

Once you have the desired ID, you can append the ID to the call to retrieve details on a single calculated metric:

GET https://cja.adobe.io/calculatedmetrics/{id}

For example, get details around the calculated metric with an ID of a5066209:

Copied to your clipboard
curl -X GET "https://cja.adobe.io/calculatedmetrics/a5066209" \
-H "x-api-key: {CLIENTID}" \
-H "x-gw-ims-org-id: {IMSORG}" \
-H "Authorization: Bearer {ACCESSTOKEN}"

Create a calculated metric

Create a calculated metric with the desired definition for use in reporting.

POST https://cja.adobe.io/calculatedmetrics

For example, create a basic calculated metric that divides visits by visitors:

Copied to your clipboard
{
"name": "Integration Test 1",
"description": "Integration Test 1 Description",
"dataId": "{DATAID}",
"type": "percent",
"definition": {
"func": "calc-metric",
"formula": {
"func": "divide",
"col1": {
"func": "metric",
"name": "metrics\/visits"
},
"col2": {
"func": "metric",
"name": "metrics\/visitors"
}
},
"version": [
1,
0,
0
]
}
}

API status codes

For a description of API status codes and tips for troubleshooting, see the Platform FAQ and troubleshooting guide.

  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.