Quickstart
5-minute guide to getting started with the Measurely API.
Quick Overview
This guide will help you:
- Create a basic metric in the Measurely dashboard.
- Update the metric value using the API.
Guide
Access the Metrics Page
Navigate to the Metrics section in the Measurely dashboard.
Click Create Metric
Here, you’ll have the option to select between a Basic Metric or a Dual Metric. Choose Basic Metric.
Enter Metric Details
Provide a name for your metric (e.g., “Sales Count”).
API KEY Integration
To send data to this metric, integrate your Measurely API KEY into your project.
To update a metric value:
-
Make a POST request to the endpoint:
POST https://api.measurely.dev/event/{API_KEY}/{METRIC_ID}
-
Include a JSON body with the value you want to add or remove:
{ "value": 100 }
Code Examples
Javascript
export const updateMetric = async (API_KEY, METRIC_ID, value) => {
const response = await fetch(
`https://api.measurely.dev/event/${API_KEY}/${METRIC_ID}`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ value: value }),
},
);
return response.status;
};