Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.67 KB

CHANGELOG.md

File metadata and controls

50 lines (36 loc) · 1.67 KB

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[1.0.0] - 2024-08-02

Added

  • First release of VWO Feature Management and Experimentation capabilities

    import vwo "github.com/wingify/vwo-fme-go-sdk"
    
    options := map[string]interface{}{
    	"sdkKey":            "your_sdk_key",
    	"accountId":         "your_account_id",
    	"gatewayServiceURL": "your_gateway_sercice_url", // http://localhost:3000
    }
    
    instance, err := vwo.Init(options)
    
    // Correct JSON string with double quotes
    customVars := `{"key": "value"}`
    
    // Parse the JSON string into a Go map
    var customVariables map[string]interface{}
    json.Unmarshal([]byte(customVars), &customVariables)
    
    // Create the user context map
    userContext := map[string]interface{}{
    	"userId":          "user_id",
    	"customVariables": customVariables, // pass customVariables if using customVariables pre-segmentation
    	"userAgent":       "visitor_user_agent",
    	"ipAddress":       "visitor_ip_address",
    }
    
    // get flag to check if feature is Enabled for the user
    getFlag, err := instance.GetFlag("feature_key", userContext)
    
    isFeatureEnabled := getFlag.IsEnabled()
    getVariableValue := getFlag.GetVariable("variable_key", "default_value")
    
    // trackEvent to track the conversion for the user
    trackEventResponse, err := instance.TrackEvent("event_name", userContext, nil) 
    
    // setAttribute to send attribute data for the user
    instance.SetAttribute("attribute_key", "attribute_value", userContext)