Custom definitions: calculated metrics and dimensions

Extend the list of metrics and dimensions available in Smart Data with the new definitions.

Calculated definitions are based on other metrics and dimensions available in Smart Data report builder and calculated by a custom formula.

You can calculate a definition using data from any connected Smart Data source set.

Read also: Custom definitions from website data

How to add a calculated definition to Smart Data

  1. Go to Smart Data and make sure the data source set you want to add a new definition to is active.
  2. Click on the active source set, then click Manage custom definitions:Custom_definitions_Main_Page_en.pngAlternatively, you can click Custom definitions in the metric/dimension menu on a report screen:Custom_definitions_add_definitions_report_screen_en.png
  3. You’ll get to the custom definitions management page for the active data source set. The source set’s name is displayed at the top of the page.
  4. Select the Calculated definitions tab, then click Add definition and follow the setup process:Custom_definitions_tab_calculated_definitions_en.png
  5. Enter the Custom definition name. This name will be used to display the custom definition in the Smart Data metrics and dimensions list:
    Custom_definitions_calculated_definitions_setup_ru.pngYou can add a Description to inform other users of your OWOX BI project what’s the purpose of this custom definition.
  6. Select the Definition type it should get in Smart Data — either a metric or a dimension.
  7. If you add a metric, you need to specify the Aggregation type for it (for example, sum or median). You can also add the Measurement unit for the metric in case you need it.
  8. Now, paste the code to the Custom definition calculation code field:______________2020-02-14___17.02.37.png
    See the examples of calculated definitions and code for their calculation below in this article. You can paste code from these examples or write to us at and tell what definitions you’d like to have calculated — we’ll help you do this.
  9. Click Save. The new custom definition will be saved and available in the current Smart Data source set.

The definition will appear in the Custom definitions group in the metrics/dimensions menu and you'll be able to use it to create or edit a report in Smart Data.

You can see the list of all your custom definitions and edit them in the corresponding tab on the Manage custom definitions page.

After adding a new definition, Smart Data generates a Unique name to use in calculations. You need to use this name in code if you want to use this custom definition to calculate another definition. This unique name is displayed in the custom definition’s settings:

Examples of calculated definitions and how to calculate them

Custom channel grouping

Make up a custom channel grouping instead of the default one.

WHEN ($trafficSource.source='direct' and $trafficSource.medium='(not set)') or $trafficSource.medium='(none)'
THEN 'Direct'
WHEN $trafficSource.medium='organic'
THEN 'Organic Search'
'(not set)'

CPO (cost per order)

Cost per order is the ad cost divided by the number of orders of the advertised product.

average(safeDivide($trafficSource.attributedAdCostSum, $transaction.numberOfTransactions))

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.