Logo
Nov 30, 2026

Org-Level Experiments in a Multi-Org World

{post.author}
by Corey Nilan

A/B experiments kicked off in earnest at Close this year. As a B2B company, we first had to answer the question of what the right unit was for assigning experiment variants. Some experiments, like pricing, need to be consistent across a customer’s whole account, which can hold several organizations. But for most experiments, the smallest unit that keeps the experience consistent is the organization, so that’s where we started. We wanted everyone in the same organization to see the same variant and every action a user takes to count toward the organization they take it in. This seemed straightforward - we'd just bucket each user by their organization ID using a deterministic hash and include that ID with every event. But of course, things are never as simple as they seem.

The Signup Race Condition

The first problem we ran into as we looked at the data coming into Amplitude was that users we expected to be exposed to the experiment were not. These users were unexpectedly being evaluated as off, meaning Amplitude wasn't assigning them to an experiment variant, even though they should have been eligible for the experiment. The key clue was that the users were all members of brand-new organizations. From there, we discovered a race condition on signup - as soon as the user and organization were created, we would make an identify() call that kicked off a chain of events ultimately providing Amplitude with profile information about the user and their organization. But a fetch to Amplitude for the user’s variants was also kicked off at nearly the same time, and it was possible for the fetch to reach Amplitude before the user’s organization ID had landed in their profile. If Amplitude didn’t have the organization ID available before it had to respond to the fetch for the user's variant, then it would evaluate the user’s variant as off.

The solution was to send the organization ID inline with the fetch, so that Amplitude had all the information it needed to respond, and it didn’t matter if the identify() call was slower than the fetch. Now we’d successfully widened our pool of users in the experiment - but the ID we were sending turned out to have a problem of its own.

Primary Org ID !== Current Org ID

We were using the Primary Org ID property as the bucketing key and assumed everyone working in the same organization would have the same value. That assumption turned out to be wrong. And since Amplitude deterministically assigns variants by hashing the bucketing key, teammates could end up in different variants.

For some context, the majority of our users belong to a single organization, but it is possible for users to be in more than one. Let’s consider the hypothetical user named Annie who works for Consultants R Us, an agency that has four clients who use Close. She has a seat in each of those organizations. The Primary Org ID is the ID of the oldest paying organization a user belongs to - in Annie's case, this happens to be Consultants R Us. This meant that no matter what organization Annie was working in, she'd always see the variant assigned to Consultants R Us. If that was the control experience, then Annie saw the control in all four of her clients’ organizations, even if everyone else in a client’s organization was seeing the treatment variant. At best, this might have caused confusion between Annie and the rest of her client’s team, who saw different versions of the same screen. At worst, Annie missed out on a change the rest of the team got. When we measured it in July, ~22% of organizations with more than one active user had members with different Primary Org Ids, meaning those members could have inconsistent experiences within the same organization.

We also realized we had a similar problem with our events. In Amplitude’s organization-level reports, the actions a user took were being attributed to their primary organization. If Annie saw the treatment UI in Acme Org and converted, that success was associated with Consultants R Us - which had the control UI. This was biasing our results since a treatment success counted toward a control organization, which made the two variants look more alike than they really were.

In practice, this bias was unlikely to change which variant won. Only a small share of the users in our experiments were working outside their primary organization, but it could still shrink the difference between the variants, making a real win look smaller or a real loss look milder. Not to mention it was problematic to have misattributed data making it impossible to trust that a chart was truly showing you activity that happened in a particular organization.

The solution for both problems was to rely on the ID of the organization the user was currently in - not their Primary Org ID. It was a simple fix to replace the Primary Org ID being sent in the fetch with the user's Current Org ID. Now all the users in an organization would see the same variant.

The events problem was a little trickier. We added a Segment source middleware that runs on every frontend event before Segment sends it anywhere and stamps the event with the user’s current org ID (organization_id). On the backend, a central function now stamps that ID onto every event that belongs to an organization.

This got us halfway there. Amplitude only credits the organization in the event's groups field. If that’s empty, it uses the organization on the user’s profile, which is always the Primary Org ID (this is why Annie’s actions were landing on Consultants R Us). All our events reach Amplitude through Segment, so the fix was to update Segment to copy organization_id into the groups field that Amplitude expected.

With both fixes in place, an organization finally behaved like we expected. Everyone in the organization got the same variant, and everything they did was credited to it.

This did come with a tradeoff. By bucketing on the current organization, we chose to prioritize consistency within an organization over consistency for an individual user. Annie might see the treatment in Acme Org and the control in another client's organization. That's intentional, because we want her to see the same thing as everyone else in a particular organization, even if that means she sees something different when she switches to another client. This does mean that if you count by user instead of by organization, multi-org users show up in both variants. When we ran an A/A test (an experiment where both variants are identical) for a few days to check our setup, only 1.4% of the users in the test were in more than one organization and saw both variants.

Handling Organization Switching

There was one last hiccup to deal with. When Annie switched from Consultants R Us to Acme Org, the app still had Consultants R Us’s control variant in memory. For a fraction of a second, it showed her that variant and logged an exposure for it - under Acme Org. Then the fetch for Acme Org came back with the right variant and logged a second exposure, and now Acme Org's data showed a user exposed to both variants. We fixed it by clearing the stored variants as soon as the organization changes. Before the fix, about 1 in 75 organizations in one experiment recorded exposures to both variants less than a second apart. Since the fix, across four experiments, none have.

Getting over these initial hurdles put our experiments in a much more consistent and reliable space, and it was an important learning experience. In each case, the implementation looked reasonable until we started examining what was actually happening in our experiments.

Some takeaways:

  1. Consider what information is critical for your analytics tool to provide a variant and then check for ways that information may be delayed or missing. For Amplitude specifically, don't count on profile updates landing in time to answer a variant request.
  2. Make sure you fully understand the definition behind the properties you use for bucketing and attribution, and check that it holds for your entire population, not just your typical user. For us, Primary Org ID was the ID of the oldest paying organization a user belonged to. For single-org users, that’s always the one they’re working in, but for multi-org users, it may not be.
  3. Look at your data as soon as it starts coming in. Check who’s being exposed to an experiment, who isn’t, and whether the distribution of variants among your users makes sense. That’s how we caught users who should have been in the experiment and weren’t as well as organizations with users in both variants.