How to Create and Integrate Custom Metrics

. 4 min read

If you have any problem with integration or don't know how to do it - ping me and I will help you with integration in any platform.

When you start making your product or run an e-commerce shop - you begin to track some metrics. How many users registered, how many messages sent or items sold. You need to track a lot of metrics and analyze what's going on inside. You start building your own dashboard with all infrastructure and analyze. We did it for you. Techmet.io will save your time and money.

The Techmet Custom Metrics is easy to integrate and you can track any metrics you want. You need to do 3 steps:

  1. Create an Account
  2. Create a Custom Metric
  3. Integrate metric into your system to Calculate Live Data
  4. Fill the data manually (optional)

Create a Custom Metric

If you want to create Custom Metric, you should Sign In, click on "Metrics" in the menu and press "Add Metric" button.

Choose Metrics then click "Add Metric"

In opened window you should fill all fields and click "Add Metric":

  • Metric title - understandable metric name, that will be shown on the top of the graph.
    Note - if this metric will be private you can use any name or abbreviation that will be understandable for you and your team. But if you want to share your metrics with a public - choose the name that everyone will understand.
  • Dashboard - If you have more than 1 dashboard then choose dashboard on which you want to show this metric. It will be useful if you want to create separated dashboards for different teams and departments.
  • Description - metric description. If you are using an abbreviation or non-standard metric, describe what are you calculating and how. It will be useful for reports and during analyze of your results.
  • Private Metric - choose if you don't want to share this metric in public
  • Show as Card (see screenshots below) - a different style of showing graphs.
"Add New Metric" Screen
Standard Metric vs Show as Card

Done. Next step is Integration.

Integration into your system

Here you should do a few small steps to integrate calculation in your product.

You can add stats to your metric in two ways:

  1. Live - when you send your metric values directly from your app.
  2. Manual - when you fill the data manually (read below)

Live:

Let's start with getting unique URL of metric: Open "Metric Details" or "Metrics" screen and find "Metric URL to Trigger"

Url to Trigger on Metrics screen
Url to Trigger on Metric Details Screen

Copy this URL: https://techmet.io/api/addmetricstats/Your_UNIQUE_INDENTIFIER

You will use this URL in your code to add a value of your metric. All you need to do is to put a few lines of code in the place where you want to calculate this metric. For example, You want to calculate how many users are registered in your system.

//node.js
const request = require('request');

// Your Code of saving new user in DB
request.get('https://techmet.io/api/addmetricstats/Your_UNIQUE_INDENTIFIER', (err, res, body) => {
   // handle error 
});

That's all. Easy, isn't it? What to do if you want to send a custom value of metric? Add "value" options in body request:

//node.js
const request = require('request');

// Your Code of order payment (visitor bought something for $33)
var options = {

uri:'https://techmet.io/api/addmetricstats/Your_UNIQUE_INDENTIFIER',
form: {value: 33}
}
request.post(options, (err, res, body) => {
	// handle error 
});

There is another way of sending custom value but with "GET" Request Type:

//node.js
const request = require('request');

// Your Code of saving new user in DB
request.get('https://techmet.io/api/addmetricstats/Your_UNIQUE_INDENTIFIER/:date/:value', (err, res, body) => {
   // handle error 
});
//Note Date should be in "YYYY-MM-DD" format and value should be Number

Note:

  • Date should be in "YYYY-MM-DD" format
  • Value should be Number

That's all. If you have any problem with integration - ping me and I will help you with integration in any platform.

Manual data filling (optional)

If you want to add your metric stats manually -> Go to Metric Details(Edit ) -> Find "Add Stats Manually" card. Here you can put any value and date of your stats.

Adding Stats Manually

If you have any problem with integration or don't know how to do it - ping me and I will help you with integration in any platform.

My Contacts:
Twitter