The following endpoints return real-time traffic data about your webpages and live audience.
To create a Custom Metric you'll need to let us know the key, the type, and the label for your metric (details below). Note that custom metrics are only available via our real-time API and are not present in our Real-Time and Historical Dashboards. Contact our support team to get started.
The explanations for these values are as follows:
- Label: A human-readable name for this metric, e.g.
product_name. The label of a metric may contain letters (A-Z, a-z) and underscores.
- Key: The key that will be reported to our servers. For example, if you are tracking user_account_type, you might use the key _acct or _utype. The shorter the better, but for a key to be reported it must begin with an underscore.
- Type: What kind of metric you are tracking and any metadata associated with the given type. The types are:
- Number: A floating point, signed number. Use for reporting numerical stats, such as average, sum, min, max, etc.
- String: Any arbitrary string, e.g. "awesome" or "pelle". No interpretation of it is made. Reports are of number of visitors with a value, top 5 values, and number of unique values.
- Enum: Data is interpreted as one of the given enum values. Multiple strings can match one enum value (eg: "female", "f", "woman", "lady", etc all get mapped to one index). The report is an un-labeled array of counts for each enum-index, eg: [4, 0, 23, 3].
Once your Custom Metric has been created, you'll need to handle the implementation on your site. To report a Metric to Chartbeat, you'll need to add it to the
_cbqobject by providing the key you emailed Chartbeat about, and a value:
var _cbq = window._cbq = (window._cbq || );
The above code will tell chartbeat.js to add
&_usr=proto all pings. You can update a Metric at any time during a user's interactions without waiting for them to reload the page or travel to a new page by merely calling
_cbq.pushagain with the same key, and a new value. The change will be reported with the next ping.