Optimizely will be sunsetting Full Stack Experimentation on July 29, 2024. See the recommended Feature Experimentation migration timeline and documentation.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket


This topic describes the Track method that tracks a conversion event or logs an error message if the specified event key does not match any existing events.

Tracks a conversion event. Logs an error message if the specified event key does not match any existing events.


SDK v1.0


Use this method to track events across multiple experiments. You should only send one tracking event per conversion, even if many feature tests or A/B tests are measuring it.



Events are counted in an experiment when an impression was sent as a result of the Activate or Is Feature Enabled method being called.

The attributes passed to Track are only used for results segmentation.

The Track function can be used to track events across multiple experiments. It will be counted for each experiment only if Is Feature Enabled or Activate has previously been called for the current user.

As long as the event key is valid (the key appears in the datafile) Optimizely will track events. Use attributes to track events for segmentation purposes.



The Results page only shows events that are tracked after Is Feature Enabled or Activate has been called. If you do not see results on the Results page, make sure that you are evaluating the feature flag before tracking conversion events.

Track events across platforms

For offline event tracking and other advanced use cases, you can also use the Events API.

You can use any of our SDKs to track events, so you can run experiments that span multiple applications, services, or devices. All of our SDKs have the same audience evaluation and targeting behavior, so you'll see the same output from feature experiment evaluation and tracking as long as you are using the same datafile and user IDs.

For example, if you're running feature experiments on your server, you can evaluate them with our Go, Python, Java, Ruby, C#, Node, or PHP SDKs, but track user actions client-side using our JavaScript, Objective-C or Android SDKs.

If you plan to use multiple SDKs for the same project, make sure that all SDKs share the same datafile and user IDs.

For more information, see Multiple languages.


This table lists the required and optional parameters for the Go SDK.

event key
stringThe key of the event to be tracked. This key must match the event key provided when the event was created in the Optimizely app.
entities.UserContextHolds information about the user, such as the userID and the user's attributes.

Important: userID must match the user ID provided to Activate or Is Feature Enabled.
mapA map of key-value pairs specifying tag names and their corresponding tag values for this particular event occurrence. Values can be strings, numbers, or booleans.

These can be used to track numeric metrics, allowing you to track actions beyond conversions, for example: revenue, load time, or total value. See details on reserved tag keys.


This method sends conversion data to Optimizely. It does not provide return values.


attributes := map[string]interface{}{
        "DEVICE": "iPhone",
        "hey":    2,

user := entities.UserContext{
        ID:         "userId",
        Attributes: attributes,

err := optlyClient.Track("add_to_cart", user)

See also

For more guidance and examples, see Track events.

Side effects

The table lists other other Optimizely functionality that may be triggered by using this method.

ConversionsCalling this method records a conversion and attributes it to the variations that the user has seen.

Full Stack 3.x supports retroactive metrics calculation. You can create metrics on this conversion event and add metrics to experiments even after the conversion has been tracked.

For more information, see the paragraph Events are always on in the introduction of Events: Tracking clicks, pageviews, and other visitor actions.

- This method will not track events when the specified event key is invalid.
- Changing the traffic allocation of running experiments affects how conversions are recorded and variations are attributed to users.
ImpressionsTrack does not trigger impressions.

Source files

The language/platform source files containing the implementation for Go is Go.