Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback
Hey! These docs are for version 2.0, which is no longer officially supported. Click here for the latest version, 3.0!

You can track conversion events from your code with the`Track` method. This method requires an **event key** and a **user ID**, and also takes optional user **attributes**; see the example below.

The **event key** should match the event key you provided when [creating events](πŸ”—ο»Ώ) in the Optimizely app.

The **user ID** should match the ID provided in the `Activate` or `Is Feature Enabled` functions. You must pass the same user attributes you used when activating the experiment.


For more information about when and how to track events, see [Event tracking](πŸ”—ο»Ώ) and the other topics in this section.

## Usage notes

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

**Attributes are required for event tracking, not just for segmentation**. Events are only tracked for users who meet the audience conditions of at least one running experiment with a metric defined for the matching event. When users do not meet those conditions, events are not tracked.


**The [Results page](πŸ”—ο»Ώ) only shows events that are tracked after `Activate` or `Is Feature Enabled` has been called**. If you do not see results on the Results page, make sure that you are activating the experiment or evaluating the feature flag before tracking conversion events.

For information about implementing the User Profile Service purely for tracking purposes and not sticky bucketing, see [Implement a Service](πŸ”—ο»Ώ).

## 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 bucketing and targeting behavior, so you'll see the same output from experiment activation and tracking as long as you are using the same datafile and user IDs.

For example, if you're running experiments on your server, you can activate experiments with our 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](πŸ”—ο»Ώ).