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
- Go to Smart Data and make sure the data source set you want to add a new definition to is active.
- Click on the active source set, then click Manage custom definitions:Alternatively, you can click Custom definitions in the metric/dimension menu on a report screen:
- 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.
- Select the Calculated definitions tab, then click Add definition and follow the setup process:
- Enter the Custom definition name. This name will be used to display the custom definition in the Smart Data metrics and dimensions list:
You can add a Description to inform other users of your OWOX BI project what’s the purpose of this custom definition.
- Select the Definition type it should get in Smart Data — either a metric or a dimension.
- 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.
- Now, paste the code to the Custom definition calculation code field:
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 firstname.lastname@example.org and tell what definitions you’d like to have calculated — we’ll help you do this.
- 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 'Organic Search'
CPO (cost per order) is the ad cost divided by the number of orders of the advertised product.