Welcome to Measurely! This guide will walk you through creating your first application, setting up your first metric, and sending data programmatically using our API. Let’s get started!
Step 1: Create Your First Application
Log in to the Measurely Dashboard:Head to Measurely Dashboard and log in using your preferred authentication method (GitHub, Google, etc.).
Create an Application:
- Provide a name for your new application
- Add an image (optional)
- Click on the Create Application button.
Step 2: Define Your First Metric
Navigate to the Metrics Section:
- Within your application, click on Create Metric.
Create a Metric:
-
Click on Add Metric and define the following:
- Type: Select a metric type (e.g., basic, dual). More are on the way
- Metric Name: Choose a meaningful name (e.g., users).
- Base Value: Provide a base value for your metric. (optional)
Click Create to add the metric.
Step 3: Set Up Your Code to Send Metrics
Now that your application and metric are ready, it’s time to integrate Measurely into your codebase.
Get Your API Key
- Click on the API Key button at the top of the page.
- Copy the API Key provided there.
Get Your Metric Id
- Navigate to the metrics page
- Click on the 3 dots of your newly created metric
- Click on Copy ID
Example: Sending Metrics Using cURL
Here’s a simple example of how to send data to Measurely:
curl -X POST https://api.measurely.dev/event/v1/YOUR_METRIC_ID \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"value": 42
}'
Example: Sending Metrics Using Javascript
If you’re using javascript, here’s an example:
export const updateMetric = async (API_KEY, METRIC_ID, value) => {
const response = await fetch(`https://api.measurely.dev/event/v1/${METRIC_ID}`, {
method: 'POST',
headers: {
'Authorization' : `Bearer ${API_KEY}`
'Content-Type': 'application/json',
},
body: JSON.stringify({ value: value }),
});
return response.status;
}
You can find more language examples in the documentation
Step 4: View Your Metrics in the Dashboard
Go to the Metrics Tab:
- Navigate to your application’s Metrics tab.
- You should see your metric and the value you just sent. Visualize Your Data:
- Use the built-in charts and filters to analyze your metrics over time.
Conclusion
You’ve successfully set up your first application, created a metric, and sent data to Measurely. From here, you can start adding more metrics, integrating Measurely deeper into your workflow, and gaining valuable insights.
Don't hesitate to leave a feedback :)
Need help? Check out our documentation or contact support at support@measurely.dev.
Top comments (0)