Unable to track event
shaistan26 opened this issue · 3 comments
HI,
I am trying to send an event using the latest version of Optimizely SDK (3.10.3).
There are not exceptions/errors while sending event However, i am unable to see any numbers in my Optimizely experiment dashboard. Below is the extracted code which i use to initialise the Optimizely client and send the tracking event request.
public static void main(String[] args) {
try {
long pollingInterval = 30;
ProjectConfigManager configManager = HttpProjectConfigManager.builder()
.withSdkKey("xxxxxxxxxxx")
.withPollingInterval(pollingInterval, TimeUnit.MINUTES)
.build();
EventHandler getEventHandler = AsyncEventHandler.builder().build();
ForwardingEventProcessor getEventProcessor =
new ForwardingEventProcessor(getEventHandler, null);
Optimizely optimizely = Optimizely.builder()
.withConfigManager(configManager)
.withEventProcessor(getEventProcessor)
.build();
String userId = UUID.randomUUID().toString();
OptimizelyUserContext userContext = optimizely.createUserContext(userId);
Map<String, Object> attributes = new HashMap<>();
attributes.put("sampleAttribute","SAMPLE");
userContext.trackEvent("sample_event", attributes);
} catch (Exception e) {
System.out.println("##########I am exception############: " + e.getMessage());
}
}
but there are no updates on the dashboard:
PS: I have matched experiment name in code and on dashboard is same .
Also i have checked event id used in code and on dashboard is same.
I would appreciate if some one could give me some pointers and/or point me to a working example of tracking event using Optimizely java SDK
@shaistan26 you're supposed to call decide
with the flag that include the experiment before track
. Then the result page will show both decision (decide
) and conversion (track
) event counts.
@jaeopt I actually had made the call userContext.decide("experiment_name");
however, this also did not work and I had mistakenly removed the line while I was writing the initial message.
@shaistan26 I see. Can you share the flag and experiment keys you're targeting? Also share the decision (output of decide
call). If the decision does not make the experiment (audience mismatch) then the event won't be dispatched for the experiment.