Measuring Experiments
Using Autocapture
Sidecar comes loaded with an event collection tool that will autocapture various web activities, allowing you to create both simple and complex Metrics within Statsig console without writing a line of code.
Using the tracking API
You can track events manually for actions that are not autocaptured by the feature described above.
To track events back to Statsig, you can call StatsigSidecar.logEvent
which takes the same arguments as the Statsig JS SDK as documented here. This method can be called prior to completion of the init routine.
// example order event
StatsigSidecar.logEvent('Order', null, {
total: 54.66,
units: 3,
unitAvgCost: 18.22
});
Post-Experiment Callback for outbound integrations
You can bind a callback that gets invoked after Sidecar has run experiments (also gets called when there are no experiments), allowing you to run code that processes the experiment assignments as needed.
This method should be defined anywhere prior to the Sidecar client script.
window.postExperimentCallback = function(statsigClient, experimentIds) {
/**
* add your own callback routine here
* ie; annotating 3rd party analytics tools with assignment info
var evarValue = [];
experimentIds.forEach(function(expId) {
var inExp = statsigClient.getExperiment(expId, { disableExposureLog: true }).groupName;
if(inExp) {
evarValue.push(expId + ':' + inExp);
}
});
evarValue = evarValue.join(',');
*/
}
Disabling All Logging
To disable all logging to statsig (both autocapture events and logging who has seen your experiments) append the following query string parameter to the Sidecar script URL: &autostart=0
. This may be useful if you're dealing with GDPR compliance, and you can later re-enable events with client.updateRuntimeOptions({disableLogging: false})