The VWO client class needs to be instantiated as an instance that exposes various API methods like activate, getVariationName and track.

Each VWO client represents the state of a project corresponding to the settingsFile. SettingsFile needs to be fetched before instantiating a VWO client. Read more on how to get SettingsFile.

API Description

SDK provides a method to instantiate a VWO client as an instance. The method accepts an object to configure the VWO client.

The only required parameter for instantiating the SDK is settings file. There are other optional parameters, which you could provide for overriding the default behavior or setting environment.

Parameter Definitions

Below is the list of all parameters that can be used for configuring the VWO SDK.

ParameterTypeDescription
settingsFile
Required
ObjectThe JSON representing your project and the campaign settings.
isDevelopmentMode
Optional
BooleanFlag for experimenting the SDK on test-app/staging so that no impression is sent to the VWO server for tracking.
userStorageService
Optional
ObjectThe JSON representing the User Campaign Data Map. Used for sticky bucketing and deciding when to call Activate API vs. getVariationName API.
logging
Optional
ObjectOverride default logger behaviour. Customise log-level, and implement your own log message.

Returns

An instance of the VWO class, which can be referenced later for calling out different API methods.

Usage

import vwo "github.com/wingify/vwo-go-sdk"
import "github.com/wingify/vwo-go-sdk/pkg/api"

// Get SettingsFile
settingsFile := vwo.GetSettingsFile("accountID", "SDKKey")

// Default instance of VwoInstance
vwoClientInstance, err := vwo.Launch(settingsFile)
if err != nil {
	//handle err
}

// Instance with custom options
vwoClientInstance, err := vwo.Launch(settingsFile, api.WithDevelopmentMode())
if err != nil {
	//handle err
}