Automattic / Automattic-Tracks-iOS

Client library for tracking user events for later analysis
GNU General Public License v2.0
41 stars 12 forks source link

Update ABTesting Variation representation. #229

Closed bjhomer closed 1 year ago

bjhomer commented 1 year ago

Most AB tests run with just control and treatment variations. These were curiously represented in the Tracks code as .control and .treatment(nil), respectively. That nil is quite confusing for such a common case.

This PR updates the representation of the common case to simply be .treatment. Custom cases are now represented with a separate enum value.

Treatment name from server Old representation New representation
"control" .control .control
"treatment" .treatment(nil) .treatment
"purple_button" .treatment("purple_button") .customTreatment(name: "purple_button")

Fixes #226