Insights

How to stitch anonymous with logged-in users in Growthbook?

Foto van Rudger de Groot
Rudger de Groot
Founder & CRO

Share

Another gem of a question found on the Growthbook Slack channel #ask-questions:

Any tips for metrics when an experiment is assigned based on anonymous_id? By the time a user takes action on metrics we measure, their anonymous_id has likely changed. Thus, their action doesn't register in our experiment. In our application the flow goes: – User lands on page, gets anonymous_id – User gets assigned to A/B based on anon_id – User creates an account and gets a proper user_id – User completes an action several days later – at this point their anonymous_id has likely changed. Is there a way I can coach growthbook to look for the user_id that gets seen with an anonymous_id at the time of signup? And from then onwards, our experiment metrics should look for that user_id and NOT the anonymous_id? Is this making sense?

BigQuery & Growthbook user

#ask-questions

So before we go into this. An important note. When you when you update the assigning attribute i.e. a userId to a new value when the visitor was already exposed to a a experiment then it’s possible that the visitor will be bucketed into a different variation as the userId is different from what it was before.

You can test this simply by creating a feature with an experiment rule and then scroll down to the Test Feature Rules section.

There just keep changing the attribute value of the assigning attribute that you choose for your experiment.

 

Then you will see that the variationId can change from value.

So it’s important that you keep the value for the assigning attribute the same throughout the visitor sessions. So in this example one could create two seperate attributes:

– anonymous_id
– proper_user_id

Keep the anonymous_id throughout the visitor and use it as an assigning attribute. Then during the journey when the proper_user_id is known set the value in the dedicated attribute proper_user_id.

Now we are sure that the visitor keeps seeing the variation to which it was bucketed originally.

As an example anonymous_id could be the value stored in your analytics client id for Google Analytics this is the value stored in the _ga cookie.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Stitching it back together

Now to keep the analysis also in the right order in such a way that you can follow anonymous users that login you can do the following. In your Growthbook datasource configuration you choose your datasource:

There you can set your Identifier Types and join them together with Join Tables.

So there you go.. now you should get proper data for analysis and also you site visitors will have a consistent experience.

We assist companies
scaling experimentation

Our GrowthBook expert

Rudger de Groot

Founder & CEO

Contact form

Discover how we’ve helped leading brands transform their digital experiences through experimentation and innovative GrowthBook solutions.

Direct contact

Nijverheidstraat 11-1E
7511 JM Enschede
the Nederlands

+31 53 234 0444