Has anybody integrated experiment tags with a 3rd ...
# announcements
f
Has anybody integrated experiment tags with a 3rd party event platform (in my case, Segment)? I'm looking to add experiment tags to every single event that comes through instead of an ExperimentExposed event indicating when they either are included or see the screen/page/element/experience in question, and am looking for some precedence on how to keep it simple for our engineers.
f
Are you using analytics.js V2 or the old analytics.js from segment?
f
We'll be implementing V2 in the next week or so
f
In that case, you can use the new middlewares feature. Something like this:
Copy code
analytics.addSourceMiddleware(
  function({ payload, next, integrations }) {
    const experiments = [];
    growthbook.getAllResults().forEach(function({experiment, result}) {
      experiments.push(experiment.key + "::" + result.variationId)
    });
    payload.obj.experiments = experiments;
    next(payload);
  }
)