Title: Targeting and Allocation Locale: en URL: https://sensorswave.com/en/docs/experiments/targeting-and-allocation/ Description: Deep dive into split mechanisms and strategy selection The split strategy determines how users are assigned to different experiment Variants — it is the core mechanism of A/B experiments. This article provides a deep dive into split ID selection, split algorithm principles, user property-based targeted split, and Allocation best practices. ## Split ID Selection ### Login ID **Definition**: A unique identifier for the user after logging in, typically the user's primary key in the business system. **Use cases**: - E-commerce platforms: User ID, member number - SaaS products: Account ID, company ID - Social products: User ID, username **Advantages**: - **Cross-device consistency**: The user sees the same experiment Variant on phone, computer, and tablet - **Long-term stability**: User sees the same Variant after logging out and back in - **Better user experience**: Avoids user confusion **Disadvantages**: - **Limited coverage**: Can only experiment on logged-in users - **Possible inconsistency before and after login**: User may see different Variants before and after login **Recommended for**: - Products requiring user login - Important experiments (e.g., checkout flow, pricing strategy) - Scenarios requiring high cross-device experience consistency See [Data Model](../data-integration/data-model.mdx) for details. ### Anonymous ID **Definition**: A unique ID identifying a user's device or browser, automatically generated by the SDK on first visit. **Storage methods**: - **Web**: Stored in cookies (`localStorage` or `sessionStorage`) - **iOS**: Stored in KeyChain or UUID generated - **Android**: Uses Android ID or UUID generated **Advantages**: - **Wide coverage**: Includes non-logged-in users - **Auto-managed**: SDK automatically generates and maintains - **No user action required**: No login needed **Disadvantages**: - **Device-level**: Same user may see different Variants on different devices - **Easily lost**: New Anonymous ID generated after user clears cookies or app data **Applicable scenarios**: - Public websites or content platforms - Landing page testing - UX optimization for non-logged-in users ### Dual ID Parallel Mechanism Users have two types of IDs simultaneously. Each ID independently matches experiments of its corresponding type without interference: - **Anonymous ID**: Exists from the user's first visit onward, automatically generated and maintained by the SDK - **Login ID**: Exists only after the user logs in, provided by the business system ``` User visits (not logged in) → Has Anonymous ID (anon_12345) → Can match all experiments using Anonymous ID as the split ID User logs in → Has both Anonymous ID (anon_12345) and Login ID (user_67890) → Anonymous ID experiments: continue using anon_12345 for split, variant unchanged → Login ID experiments: use user_67890 for split, match corresponding variant ``` **Key points**: - When creating an experiment, choose the split ID type (Anonymous ID or Login ID) - Anonymous ID experiments: all users (including non-logged-in) can match, variant stays consistent before and after login - Login ID experiments: only logged-in users can match, ensuring cross-device experience consistency - The two ID types split independently; the same user can participate in both types of experiments simultaneously --- ## Split Algorithm Details ### Hash-Based Split Algorithm Sensors Wave uses a stable hash algorithm: ``` Variant index = hash(user_id + experiment_key) % 100 ``` **Steps**: 1. **Concatenate strings**: Combine user ID and experiment key ``` input = "user_12345" + "cart_button_color_test" ``` 2. **Calculate hash value**: Use a hash function (e.g., MD5, SHA-256) ``` hash_value = hash("user_12345cart_button_color_test") ``` 3. **Modulo operation**: Take modulo 100, resulting in a number from 0–99 ``` bucket = hash_value % 100 ``` 4. **Assign Variant**: Based on Allocation, determine the user's Variant ``` if (bucket 5%), check the configuration ### Q: Will the same user participating in multiple experiments cause conflicts? **A**: No. Split across different experiments is independent. The same user can participate in multiple experiments simultaneously and be assigned to different Variants in each. ### Q: Can the Allocation be modified while the experiment is running? **A**: Not recommended. Modifying Allocation disrupts sticky assignment and affects experiment results. If changes are necessary, stop the current experiment and create a new one. --- ## Related Documentation - [Core Concepts](core-concepts.mdx): Understand split mechanism principles - [Experiment Design](experiment-design.mdx): Choose the right split strategy - [Data Model](../data-integration/data-model.mdx): Understand Login ID and Anonymous ID --- **Last updated**: January 29, 2026