File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
java-quickstart/src/main/java/com/optimizely Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 12
12
import java .util .HashMap ;
13
13
import java .util .Map ;
14
14
15
+ import java .util .Random ;
16
+
15
17
public class Example {
16
18
public static void main (String [] args ) {
17
19
@@ -20,12 +22,14 @@ public static void main(String[] args) {
20
22
try {
21
23
Optimizely optimizely = Optimizely .builder (datafile , new AsyncEventHandler (100 ,2 )).build ();
22
24
System .out .println ("hello world" );
25
+ Random random = new Random ();
26
+ String user = String .valueOf (random .nextInt ());
23
27
Map <String ,String > attributes = null ;//new HashMap<>();
24
28
//attributes.put("browser_type", "crome");
25
- Variation v = optimizely .activate ("background_experiment" , "testuserid" , attributes );
29
+ Variation v = optimizely .activate ("background_experiment" , user , attributes );
26
30
if (v != null ) {
27
31
System .out .println (String .format ("Found variation %s" , v .getKey ()));
28
- optimizely .track ("sample_conversion" , "testuserid" , attributes );
32
+ optimizely .track ("sample_conversion" , user , attributes );
29
33
Thread .sleep (10000 );
30
34
}
31
35
else {
You can’t perform that action at this time.
0 commit comments