You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository houses the Go SDK for use with Optimizely Feature Experimentation and Optimizely Full Stack (legacy).
8
+
9
+
Optimizely Feature Experimentation is an A/B testing and feature management tool for product development teams that enables you to experiment at every step. Using Optimizely Feature Experimentation allows for every feature on your roadmap to be an opportunity to discover hidden insights. Learn more at [Optimizely.com](https://www.optimizely.com/products/experiment/feature-experimentation/), or see the [developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/welcome).
10
+
11
+
Optimizely Rollouts is [free feature flags](https://www.optimizely.com/free-feature-flagging/) for development teams. You can easily roll out and roll back features in any application without code deploys, mitigating risk for every feature on your roadmap.
12
+
13
+
## Get Started
14
+
15
+
Refer to the [Go SDK's developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/go-sdk) for detailed instructions on getting started with using the SDK.
16
+
17
+
### Requirements
18
+
19
+
Requires Golang version 1.13 or higher.
20
+
21
+
### Install the SDK
22
+
23
+
#### Install from github:
9
24
10
25
```$sh
11
26
go get github.com/optimizely/go-sdk
12
27
```
13
28
14
-
### Install from source:
29
+
####Install from source:
15
30
```$sh
16
31
go get github.com/optimizely/go-sdk
17
32
cd $GOPATH/src/github.com/optimizely/go-sdk
@@ -21,7 +36,7 @@ go install
21
36
NOTE:
22
37
We practice trunk-based development, and as such our default branch, `master` might not always be the most stable. We do tag releases on Github and you can pin your installation to those particular release versions. One way to do this is to use [*Go Modules*](https://blog.golang.org/using-go-modules) for managing external dependencies:
23
38
24
-
### Install using go.mod:
39
+
####Install using go.mod:
25
40
26
41
```
27
42
module mymodule
@@ -49,46 +64,72 @@ go get github.com/optimizely/go-sdk/pkg
49
64
```
50
65
will install it as a package to pkg directory, rather than src directory. It could be useful for future development and vendoring.
51
66
52
-
## Usage
53
67
54
-
### Instantiation
55
-
To start using the SDK, create an instance using our factory method:
68
+
## Use the Go SDK
69
+
70
+
See the example file in examples/main.go.
71
+
72
+
### Initialization
56
73
57
74
```
58
75
import optly "github.com/optimizely/go-sdk"
59
76
import "github.com/optimizely/go-sdk/client"
60
77
61
-
// Simple one-line initialization with the SDK key
62
-
client, err := optly.Client("SDK_KEY")
78
+
// Simple one-line initialization with the SDK key
79
+
optlyClient, err := optly.Client("SDK_KEY")
63
80
64
-
// You can also instantiate with a hard-coded datafile using our client factory method
65
-
optimizelyFactory := &client.OptimizelyFactory{
66
-
Datafile: []byte("datafile_string"),
81
+
// You can also instantiate with a hard-coded datafile using our client factory method
82
+
optimizelyFactory := &client.OptimizelyFactory {
83
+
Datafile: []byte("datafile_string"),
84
+
}
85
+
optlyClient, err = optimizelyFactory.Client()
86
+
```
87
+
### Make Decisions
88
+
```
89
+
import (
90
+
optly "github.com/optimizely/go-sdk"
91
+
)
92
+
93
+
// instantiate a client
94
+
client, err := optly.Client("SDK_KEY")
95
+
96
+
// User attributes are optional and used for targeting and results segmentation
97
+
attributes := map[string]interface{}{
98
+
"state": "California",
99
+
"likes_donuts": true,
100
+
}
101
+
102
+
user := client.CreateUserContext("optimizely end user", attributes)
Full Stack SDKs open a well-defined set of public APIs, hiding all implementation details. However, some clients may need access to project configuration data within the "datafile".
11
+
Optimizely Feature Experimentation and Optimizely Full Stack (legacy) SDKs open a well-defined set of public APIs, hiding all implementation details. However, some clients may need access to project configuration data within the "datafile".
12
12
13
13
In this document, we extend our public APIs to define data models and access methods, which clients can use to access project configuration data.
Copy file name to clipboardExpand all lines: docs/readme-sync/sdk-reference-guides/go-sdk/070 - event-batching-go.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ hidden: true
6
6
createdAt: "2019-10-29T23:36:28.978Z"
7
7
updatedAt: "2020-01-16T20:42:04.941Z"
8
8
---
9
-
The [Optimizely Full Stack Go SDK](https://github.com/optimizely/go-sdk) batches impression and conversion events into a single payload before sending it to Optimizely. This is achieved through an SDK component called the event processor.
9
+
The [Optimizely Feature Experimentation Go SDK](https://github.com/optimizely/go-sdk) batches impression and conversion events into a single payload before sending it to Optimizely. This is achieved through an SDK component called the event processor.
10
10
11
11
Event batching has the advantage of reducing the number of outbound requests to Optimizely depending on how you define, configure, and use the event processor. It means less network traffic for the same number of Impression and conversion events tracked.
0 commit comments