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 1212import java .util .HashMap ;
1313import java .util .Map ;
1414
15+ import java .util .Random ;
16+
1517public class Example {
1618 public static void main (String [] args ) {
1719
@@ -20,12 +22,14 @@ public static void main(String[] args) {
2022 try {
2123 Optimizely optimizely = Optimizely .builder (datafile , new AsyncEventHandler (100 ,2 )).build ();
2224 System .out .println ("hello world" );
25+ Random random = new Random ();
26+ String user = String .valueOf (random .nextInt ());
2327 Map <String ,String > attributes = null ;//new HashMap<>();
2428 //attributes.put("browser_type", "crome");
25- Variation v = optimizely .activate ("background_experiment" , "testuserid" , attributes );
29+ Variation v = optimizely .activate ("background_experiment" , user , attributes );
2630 if (v != null ) {
2731 System .out .println (String .format ("Found variation %s" , v .getKey ()));
28- optimizely .track ("sample_conversion" , "testuserid" , attributes );
32+ optimizely .track ("sample_conversion" , user , attributes );
2933 Thread .sleep (10000 );
3034 }
3135 else {
You can’t perform that action at this time.
0 commit comments