This section details sending Metrics to Anodot using an API (as opposed to using out of the box connectors).
The most up to date documentation of Anodot APIs can be found here.
AUTHENTICATION
All requests to Anodot's API must be authenticated and require an API token. To have access to Token Management you must be an Admin user. See Token Management.
DEFINITION
POST https://<application url>/api/v1/metrics?token=<api token>&protocol=<protocol>
APPLICATION URLS
Your Anodot application URL is based on which data center your account is hosted or not and whether or now you use your own subdomain. For a detailed explanation on application URLs, see Login and API URLs.
DESCRIPTION
Anodot supports three different protocols for sending metrics. These protocols are a result of an evolution of the product and for new implementations / use-cases we strong recommend using the latest one - 'anodot30'
For a best practice document on how to work with the Metrics 3.0 Protocol - please see the attached "Anodot Metrics 3.0 Guide" document.
WHAT IS THE DIFFERENCE BETWEEN THE THREE PROTOCOLS?
Both the version 2.0 and 3.0 protocols work with a schema - this means that the data is structured into key-value pairs and enables Anodot to better 'understand' and interact the metrics sent to it. The main difference between 2.0 and 3.0 is that 3.0 enable sending a 'watermark' notification to Anodot, enabling a better detection and assignment of data points to a time frame.
In legacy cases where the metrics cannot be represented in Metrics 2.0/3.0 Format, use Metrics 1.0 format. However - Please notice that as of January 2021, the 1.0 Metrics format is deprecated.
See below the specifications for using the older versions.
METRICS 2.0
Metrics 2.0 Protocol definitions
Metrics 2.0 Format definitions
METRICS 1.0
Metrics 1.0 Protocol definitions
Metrics 1.0 Format definitions
RECOMMENDATIONS FOR METRICS 1.0 PROTOCOL
- Use the following properties:
- A property name “unit”. The unit value will be shown in the metrics UI, alerts and dashboards.
- A property name “ver”. The “ver” property will treated as a metric version property to ease the maintenance and deletion of metrics during the integration.
- Always put a target_type explicitly per data point. The target_type property represents how samples of the same metric are aggregated in Anodot.
Valid values are: gauge (average aggregation), counter (sum aggregation). - Use identical properties names and values across all metrics even if their data source is different.
For example:- Sessions by device_type (desktop, mobile, tablet) and orders by device (DESKTOP, TABLET, MOBILE).
In this case we recommend for both metrics that the property name will be the same in both metrics (either device or device_type).
The similar values must be the same as well (either lowercase or uppercase).
- Sessions by device_type (desktop, mobile, tablet) and orders by device (DESKTOP, TABLET, MOBILE).
- Metric tags are optional and can be considered as metadata of the metric. Tags do not affect the uniqueness of the metric name/definition.
In the Anodot portal, you can search by tags and properties. - The timestamp of when the metric sample was measured in Unix epoch time in seconds as a whole number (Integer).
The timestamp should be at the most 1 hour in the future. - Expect the sample array to be sorted by the sample timestamp; samples are processed in the order they appear in the given JSON array - out-of-order samples (in the context of the same metric) will be discarded.
- The “value” field must be a decimal double precision number without thousands separator. For example: 5.12345, 50000.45 etc
EXAMPLE REQUEST [1]
curl \
-X POST \
-d "[{"properties":{"what":"NumberPurchases","Geo":"US", "Device":"Mobile","ProductCategory":"Shoes","target_type":
"counter"},"tags":{"ActiveCampaignID":["1234"],"AccountManagers":["JohnDoe", "MaryJane"]},"timestamp":143876178,"value":58}]" \
-H "Content-Type: application/json" \
'https://api.anodot.com/api/v1/metrics?token=<api token>&protocol=anodot20'
EXAMPLE REQUEST [2] Includes 2 metric samples
curl \
-X POST \
-d "[{"properties":{"what":"NumberPurchases","Geo":"US", "Device":"Mobile","ProductCategory":"Shoes","target_type":"counter"},"tags":{"ActiveCampaignID":["1234"],"AccountManagers":["JohnDoe", "MaryJane"]},"timestamp":143876178,"value":58},{"properties":{"what":
"Revenue","Geo":"US", "Device":"Mobile","ProductCategory":"Shoes"},"tags":{"ActiveCampaignID":["1234"],"AccountManagers":["JohnDoe", "MaryJane"]},"timestamp":143876191,"value":3458.423}]" \
-H "Content-Type: application/json" \
'https://api.anodot.com/api/v1/metrics?token=<api token>&protocol=anodot20'
Note
Expect the sample array to be sorted by the sample timestamp; samples are processed in the order they appear in the given JSON array - out-of-order samples (in the context of the same metric) will be discarded.
EXAMPLE RESPONSE
{
"errors": []
}