Quickstart

A 5-minute guide to getting started with the Measurely API.

Quick Overview

This guide will help you:

  1. Create a basic metric in the Measurely dashboard.
  2. Update the metric value using the API.

Creating a Basic Metric


1
Step 1: Access the Metrics Page

Navigate to the Metrics section in the Measurely dashboard.

2
Step 2: Click Create Metric

Here, you'll have the option to select between a Basic Metric or a Dual Metric. Choose Basic Metric.

3
Step 3: Enter Metric Details

Provide a name for your metric (e.g., "Sales Count").

4
Step 4: API KEY Integration

To send data to this metric, integrate your Measurely API KEY into your project.

Updating a Metric via API

To update a metric value:

  1. Make a POST request to the endpoint:

    POST https://api.measurely.dev/event/{API_KEY}/{METRIC_ID}
    
  2. Include a JSON body with the value you want to add or remove:

    {
      "value": 100
    }
    

Code Examples

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;
};