Rich-text Reply

Adding Users to Segments Post-Conversion - Is it possible?

jshklt 06-26-14

Adding Users to Segments Post-Conversion - Is it possible?

In our most recent test, our conversion goal is triggered via the API on the Thank You page (both revenue and overall conversion are being pushed to Optimizely via the API). Further down in the source code, we're displaying a snippet that adds that user to a specific segment, also through the API.

 

We're seeing strange data where a few users are getting bucketed correctly, but the vast majority aren't. I should point out that we'd like these users bucketed for post-test analysis, we're not looking to include/exclude visitors from appearing in the aggregate results.

 

TL;DR: Can a user be added to a segment via the API after they've triggered a conversion event?

Level 2

Junan 07-01-14
 

Re: Adding Users to Segments Post-Conversion - Is it possible?

Hi there,

Unfortunately, you'll need to add visitors to a segment PRIOR to their conversions. When a goal is converted on, the segment information is attached to that goal when it is sent to Optimizely. In more technical terms, when you use the "addToSegment" API call, it simply updates the visitor's cookies to show that they are part of a segment so it can be attached to the tracking call that is sent to Optimizely.

The reason that you're seeing some visitors included and convert with the segment is likely because the visitor converted again after they were added to the segment.

Can you move the segment API call to be above the revenue and conversion custom event? If you do that, these conversions will be associated with this segment. The other thing you can do, if all you care about is just seeing that the visitor was in the segment is you can add a dummy trackEvent call directly after you call the "addToSegment" API call which will force the visitor to be associated to the segment.

Hope that helps!
Junan Pang
Optimizely