# Statsig Sidecar

Statsig sidecar helps marketing teams build and run experiments without needing to write or modify code.

You can register a pre-init experiment callback through `window.statsigSidecarConfig`:

```js
window.statsigSidecarConfig = {
  onExperimentEvaluation: function (event) {
    // event.name === "experiment_evaluation"
    // event.experiment is the full Statsig experiment instance
    // event.experimentName is the Sidecar experiment name
    // event.groupName is the assigned group / variant
  },
};
```

Unlike `window.postExperimentCallback`, `onExperimentEvaluation` fires once per Sidecar experiment evaluation, including experiments activated later through prerun scripts via `StatsigSidecar.activateExperiment(...)`.

Example:

```js
window.statsigSidecarConfig = {
  onExperimentEvaluation: function (event) {
    window._ddm.trigger("ab_testing", {
      data: {
        experiment_id: event.experimentName,
        experiment_variant: event.groupName,
      },
    });
  },
};
```

Publishing:

from repo root

`npm version <level>`

Create a new PR to bump the version

After the PR has merged, from repo root

`npm publish`

This will prompt you for NPM credentials, and publish the package to https://www.npmjs.com/package/statsig-sidecar-v2-beta