Skip to main content

Logging Events

After creating your first gate, you want to start logging events in order for the system to understand what you care about. These events are then automatically derived into metrics and used to quantify the impact of your features on the health of the overall product.

How to log events

There are two ways Statsig can ingest events. The simplest method is to use one of our many Server/Client SDKs, or use one of the many Data Connectors available in the Integrations setting.

Logging events via SDKs

All our SDKs provide a very simple API to log events. They look like this:


Where event name describes a notable event in your product, like sign_up, achievement_unlocked, add_to_cart, check_out, etc.

These events can optionally take an event value. For instance, you can use this field to specify the type of achievement that was unlocked, or the name of the product that was added to cart, or the price of the item that was purchased.

And finally, the metadata field allows you to specify even more details about the event. Here's an couple examples of how a logEvent call looks like:

'add_to_cart', // Name
19.99, // Price
item_id: 'BC22010',
cart_size: 2,
user_segment: 'first_time_purchaser',

An example in CSharp

"level_completed", // Event Name
11, // Level number
new Dictionary<string, string>()
{ "score", "452" }
Log as much as you want

We encourage you to log as many events as you can and want. The more events there are, the more holistic picture you will get when you are building and releasing new features.

Where do these events end up?

The events you log is aggregated and analyzed by Statsig to give you useful metrics. These can be viewed in the Metrics Tab.


Statsig also provides a view into a set of derived user metrics like DAU, WAU, Stickiness, etc. just based on the events you log. Here's a view of those metrics available in the Users page in Metrics Tab.

Metrics > Users

Still Stuck?

Join our Slack community and chat with our Engineers and Data Scientists