Random cohort branch function
Learn more about the random cohort branch workflow function within Knock's notification engine.
The random cohort branch function enables you to split recipients into randomized cohorts within your workflows, routing each recipient down a specific branch based on a percentage-based distribution. This is useful for A/B testing notification content, gradually rolling out new notification strategies, or running experiments across your recipient base.
How it works
#When a workflow run reaches a random cohort branch step, Knock assigns the recipient to a cohort using the following process:
- Cohort key. Knock hashes the cohort key (which defaults to the recipient ID) to produce a deterministic assignment. This means the same recipient will always be routed to the same cohort for a given step, ensuring consistency across workflow runs.
- Percentage distribution. Each cohort is assigned a percentage weight. Knock uses these weights to determine which cohort the hashed key maps to. The percentages across all cohorts must sum to 100%.
- Branch execution. Once assigned, the recipient proceeds through the steps defined in their cohort's branch.
Configuring cohorts
#Each random cohort branch step starts with two cohorts by default. You can add additional cohorts or adjust the percentage distribution between them.
- Percentage weights. Set the percentage for each cohort to control the distribution of recipients. The total across all cohorts must equal 100%.
- Cohort key. By default, the cohort key is the recipient ID. You can customize this to any value from the workflow run scope, which is useful when you want the same user to be assigned to different cohorts in different contexts.
Use cases
#The random cohort branch function is well-suited for:
- A/B testing. Test different notification templates, copy, or channels to see which performs better. For example, split recipients 50/50 between two email templates to measure engagement.
- Gradual rollouts. Roll out a new notification strategy to a small percentage of recipients before expanding to all users.
- Experimentation. Run multi-variant experiments by splitting recipients across three or more cohorts with different notification flows.
Nesting random cohort branches
#Random cohort branch steps can be nested inside other random cohort branches, regular branches, or any other workflow function. This enables you to create more complex experimental setups, such as splitting recipients into cohorts and then further splitting within each cohort.
Analytics
#Debugging random cohort branches
#You can debug random cohort branch execution in the workflow debugger. During a workflow run, the debugger shows which cohort was chosen for each recipient, including the cohort key value used for assignment and the percentage distribution across cohorts.