Sending Events

Events track user actions like clicks, sign-ups, or purchases.

In this third step, we’ll track two events for the new-feature flag (from Quickstart: Set Up a Flag) to test if the new layout boosts conversions in an experiment.

  • Sign-Up CTA Click (sign-up clicks within the layout (Disabled / Enabled)
  • Sign-Up Complete (completed sign-ups).
1

Check SDK Setup

Ensure the SDK is initialized (from Quickstart: Integrate the SDK):

import { FlagSyncFactory } from '@flagsync/js-sdk';


const factory = FlagSyncFactory({

  sdkKey: 'your-sdk-key',

  core: {

    key: 'userId_0x123'

  }

});


const client = factory.client();

await client.waitForReady();
2

Track CTA Clicks

Add a track() call when users click the CTA:

<Button id="signup-btn" onClick{() => {

  client.track('signup-cta-click')

  router.push('/signup')

}}>

  Sign Up

</Button>
3

Track Sign-Ups

Log when users complete registration:

function onSignUpComplete() {

  client.track('signup-complete');

}
4

Verify in Dashboard

  • In the Dashboard, Click ”+” next to Metrics or go to Create a Metric.
  • Check that signup-cta-click and signup-complete appear in the “Select Event” dropdown—they’ll auto-populate from these track calls.
  • You also also watch Live Events from the Dashboard.

Next Steps

Events are flowing—now use them: