Skip to main content
All CollectionsData TransformationMetrics
How to Create a Custom Metric
How to Create a Custom Metric

Learn how to create your own metrics

Peter Lundberg avatar
Written by Peter Lundberg
Updated over 2 months ago

Metrics are a central concept in Funnel. They contain the numerical measures from your connected data sources. You can also create your own custom metrics that are based on the fields from your data sources or other custom metrics. These can be used just like any other metric in Funnel.

Creating a new custom metric

To create a new metric you have the following choices available on the metrics page:

  • Create Metric - Create a new metric from scratch

  • Copy from other Workspaces - Re-use one or more metrics from other Workspaces that you can later adjust in this Workspace

  • Create with standard rules - Create a new metric that uses Funnel's standard rules (e.g. Workspace-wide totals for Cost, Clicks, and Impressions). These can be overridden to create the logic you need in this Workspace

Then you can see and adjust attributes common to all metrics:

  • Id - A unique identifier for the metric, used in exports, etc.

  • Name - A name used in metric listings, tables, etc.

  • Description - A longer description explaining the metric's use case

  • Unit - Monetary, number, percentage, or duration describe how to display and interpret the value

  • Precision - The number of decimals to display

  • Aggregation - How multiple values are combined

After this you need to decide how the calculation should be done:

  • Formula - Simple math. For example Cost / Clicks

  • Rules - Based on conditions. For example, varying definition of Cost depending on data source

Examples of these are detailed below. Once the definition is saved you can use it in Funnel's Data Explorer, Data Warehouse exports, Dashboards, etc.


Formula

If you, for instance, want to create a metric that shows the cost per session, which you define as cost divided by sessions, it would be expressed as a simple math expression: Cost / Sessions 

This can be typed in as a formula in the input field that will help to search for what underlying fields can be used. Other common examples are:

  • Client cost  Cost * 1.1 

  • Net revenue Revenue - Cost 

  • Revenue per Session  Revenue / Sessions 

  • Client ROAS Revenue / (Cost * 1.1) 

Other formula metrics (custom or from data sources) cannot be re-used in a formula. Nor can one use any conditions. So, in order to express more advanced logic or to simplify and re-use concepts, you can use rule-based metrics.


Rules

If you, for instance, want to create a metric that varies the definition of Conversions depending on the data source that could be expressed as:

For Adwords data, set the value to Adwords All conv.
For Facebook Ads data, set the value to Website Conversions.
For Google Analytics data, set the value to Goal 1 + Goal 6


This is done by adding rules in the Rule editor. One can also add multiple conditions and do other transformations on the selected values. The order of the rules can be important as the first match is used. Other examples of rule-based metrics are:

  • Billed cost
    when Campaign contains "_A1_" then Cost * 1.1,
    when Campaign contains "_A2_" then Cost * 1.2,
    otherwise Cost

  • AppsFlyer installs when Event name is "install" use Count

  • Revenue ex tax
    when Market contains "US" then Revenue * 0.8,
    when Market contains "UK" then Revenue * 0.75,

  • Calculated Revenue
    when Campaign contains "|c7" then Total Conversions * 1.07,
    when Campaign contains "|c20" then Total Conversions * 1.2,

Read more about how to work with rule based metrics

Did this answer your question?