---
title: Configure a notification listener using the Go SDK
slug: feature-experimentation/docs/set-up-notification-listener-go
docTags: 
createdAt: 2026-08-05T20:39:56.000Z
---

Notification listeners trigger a callback function that you define when certain actions are triggered in the SDK.

The most common use case is to send a stream of all feature flag decisions to an analytics provider or to an internal data warehouse to join it with other data that you have about your users.

## Notification listener types

For information about notification listener types and use cases, see [Notification listeners](docId:0d__cjuKECyJGqgTV0_5e).

## Configure each type of notification listener

The following example code shows how to configure and remove each type of notification listener.

```go
// Create default Client
optimizelyFactory := &client.OptimizelyFactory{
  SDKKey: "[SDK_KEY_HERE]",
}
optimizelyClient, err := optimizelyFactory.Client()
if err != nil {
	// handle error
}


// SET UP DECISION NOTIFICATION LISTENER

onDecision := func(notification notification.DecisionNotification) {
  // Add a DECISION Notification Listener for type FLAG
  if string(notification.Type) == "flag" {
    // Access information about feature, for example, key and enabled status
    fmt.Print(notification.DecisionInfo["flagKey"])
    fmt.Print(notification.DecisionInfo["enabled"])
    fmt.Print(notification.DecisionInfo["decisionEventDispatched"])
  }
}
notificationID, err := optimizelyClient.DecisionService.OnDecision(onDecision)
if err != nil {
	// handle error
}

// REMOVE DECISION NOTIFICATION LISTENER

optimizelyClient.DecisionService.RemoveOnDecision(notificationID)

// SET UP LOG EVENT NOTIFICATION LISTENER

onLogEvent := func(eventNotification event.LogEvent) {
  // process the logEvent object here (send to analytics provider, audit/inspect data)
}
notificationID, err = optimizelyClient.EventProcessor.OnEventDispatch(onLogEvent)
if err != nil {
	// handle error
}

// REMOVE LOG EVENT NOTIFICATION LISTENER

optimizelyClient.EventProcessor.RemoveOnEventDispatch(notificationID)

// SET UP OPTIMIZELY CONFIG NOTIFICATION LISTENER

// listen to OPTIMIZELY_CONFIG_UPDATE to get updated data
// You will get notifications whenever the datafile is updated, except for SDK initialization
onConfigUpdate := func(notification notification.ProjectConfigUpdateNotification) {
}
notificationID, err = optimizelyClient.ConfigManager.OnProjectConfigUpdate(onConfigUpdate)
if err != nil {
	// handle error
}

// REMOVE OPTIMIZELY CONFIG NOTIFICATION LISTENER

optimizelyClient.ConfigManager.RemoveOnProjectConfigUpdate(notificationID)

// SET UP TRACK LISTENER

onTrack := func(eventKey string, userContext entities.UserContext, eventTags map[string]interface{}, conversionEvent event.ConversionEvent) {
  // process the event here (send to analytics provider, audit/inspect data)
}

notificationID, err = optimizelyClient.OnTrack(onTrack)
if err != nil {
	// handle error
}

// REMOVE TRACK LISTENER

optimizelyClient.RemoveOnTrack(notificationID)
```
