API Library
The API library contains many helper functions that allow for rapid development, by re-using existing patterns and helper functions.
Most of the helper functions are found in the Utils
class, for example:
Utils.createUserFilter(clusterResults.data.segments[0], clusterResults)
Utils.amountOfDataFor(now, minimumDaysOfDataNeeded)
- Simple text and number formatting:
Utils.humanize("some_snake_case_text")
orUtils.formatNumber(0.8599588, {percentage: true, decimals: 2}
.
Other helper functions for working with data and plugins are usually found in PluginData and ReportData.
Additonally the following external libraries are available, indicated by the variable names below, available in any JS
or JSX
context for Insights and Plugins:
_
— Lodashmoment
— moment-jsStats
— simple-statisticsSHA1
— js-sha1ObjectHash
— object-hashHighcharts
— Highcharts