Implementation

To learn how to implement experiments with Winning Variant, read more about the Variant API.

Manage through Snowflake

Roles

A user must be assigned of the following application roles to execute any of the procedures described on this page:

  • admin
  • editor

Get assignments

To get assignments for a given subject, call the following stored procedure in Snowflake:

CALL <application_name>.experimentation.get_assignments('<subject_id>', ARRAY('<experiment_id>'));

Returns a table of assignments for the given subject ID, including the following columns:

ColumnDescriptionData Type
experiment_idExperiment IDVARCHAR
variant_idID of the variant the subject is assigned within the experiment.VARCHAR
new_assignmentWhether this assignment was made as part of this request (always false).BOOLEAN

Examples

-- Get the assignment for user `user_0001` in the `home-cta` experiment
CALL <application_name>.experimentation.get_assignments('user_0001', ('home-cta'));

-- Get the assignment for user `user_0001` in the `home-cta` and `cart-notice` experiments
CALL <application_name>.experimentation.get_assignments('user_0001', ('home-cta','cart-notice'));

Get or make assignments

Gets an assignment or makes one if it doesn’t exist:

CALL <application_name>.experimentation.get_or_make_assignments('<subject_id>', ARRAY('<experiment_id>'));

Returns a table of assignments for the given subject ID, including the following columns:

ColumnDescriptionData Type
experiment_idExperiment IDVARCHAR
variant_idID of the variant the subject is assigned within the experiment.VARCHAR
new_assignmentWhether this assignment was made as part of this request.BOOLEAN

Examples

-- Get or make an assignment for user `user_0001` in the `home-cta` experiment
CALL <application_name>.experimentation.get_or_make_assignments('user_0001', ('home-cta'));

-- Get or make an assignment for user `user_0001` in the `home-cta` and `cart-notice` experiments
CALL <application_name>.experimentation.get_or_make_assignments('user_0001', ('home-cta','cart-notice'));