Amplitude

Send Coframe treatment events to Amplitude using a bulkCallbackV2 snippet.

Guide~1 min read

Copy this guide and your current settings as a prompt for your AI agent.

Preview agent promptSee the guide, code and settings included when you copy.

Coframe can send treatment data to Amplitude in two ways: as a track event (useful for funnel and chart analysis) or as user properties via an identify call (useful for cohort segmentation). Use whichever variant — or both — fits your Amplitude workflow.

On this page
  1. 01Variant 1: Event tracking
  2. 02Variant 2: User properties (identify)
  3. 03Where to place it
  4. 04What gets sent

01Variant 1: Event tracking

Add this bulkCallbackV2 to log a coframe_treatment_applied event for every treatment a visitor receives.

JS
{
  bulkCallbackV2: function(treatments) {
    if (!window.amplitude || !treatments || !treatments.length) return;

    treatments.forEach(function(t) {
      window.amplitude.track("coframe_treatment_applied", {
        cf_user_token: t.coframe_user_token,
        cf_variant_id: t.coframe_variant_id,
        cf_variant_slug: t.coframe_variant_slug,
        cf_experiment_id: t.coframe_experiment_id,
        cf_experiment_slug: t.coframe_experiment_slug,
        cf_impression_id: t.coframe_impression_id,
        cf_is_global_holdout: String(t.coframe_in_global_holdout),
        cf_is_baseline: String(t.coframe_in_exp_baseline),
      });
    });
  }
}

02Variant 2: User properties (identify)

Add this bulkCallbackV2 to tag the user profile with each experiment’s assigned variant slug, enabling cohort-based analysis.

JS
{
  bulkCallbackV2: function(treatments) {
    if (!window.amplitude || !treatments || !treatments.length) return;

    var identifyEvent = new window.amplitude.Identify();
    treatments.forEach(function(t) {
      if (t.coframe_experiment_slug) {
        identifyEvent.set(
          "cf_" + t.coframe_experiment_slug,
          t.coframe_variant_slug
        );
      }
    });
    window.amplitude.identify(identifyEvent);
  }
}

03Where to place it

Place either (or both) snippets inside your Coframe analytics callback as described in Tracking Settings.

04What gets sent

Each call passes the coframe_* fields from the treatment object. These fields are described in Experiment Assignment & IDs.

Related reading

Content and video lessons from Coframe documentation. Code examples are not executed on this page.

BACK TOAnalytics Integrations

Documentation

Open Coframe App

Search documentation

Search all guides and references↑ ↓ Navigate · Esc Close