Skip to content



A/B testing in Sanity Studio with PostHog

A quick walkthrough of A/B testing a hero button with Sanity Studio and PostHog. Set up control and variant pages in Sanity, ship them to users, and read exposures, clicks per user, and winners str…

Frequently asked questions

What is AB testing in Sanity Studio?
AB testing in Sanity Studio lets you create different variations of content, like buttons with different colors, and serve them to users to see which performs better. You set up a control version and one or more test variations, then track how users interact with each one to determine which wins.
How do you set up an AB test in Sanity?
In Sanity's AB testing space, you add your control variation and name your other variations, like we called ours blue. You can also create multiple pages for each variation if you need them. The setup is straightforward and you can customize it for whatever you want to test.
What metrics does PostHog show for AB tests?
PostHog displays total exposures, which is how many times a variation was shown to users, and average clicks per user for each variation. You can see these metrics side by side to compare performance between your control and test versions, along with additional charts and data points.
How can you tell which variation is winning?
Compare the average clicks per user between your variations. In our example, the blue button had nine clicks per user on average while the control had eight, making the blue variation the winner. PostHog makes it easy to see these numbers and determine which version performs better.
What kinds of things can you AB test?
You can test button variations, form clicks, different pages, or really any use case where you want to measure user interaction. The system is flexible enough to accommodate whatever variations you want to compare across your product or site.
Is this tool free to use?
Yes, the tool is completely open source, so you can use it without paying for a license. You can set it up for yourself and start running tests right away with no cost barriers.
How easy is it to track test results?
Once you set up your variations in Sanity, they automatically feed into PostHog and you can see all your metrics and charts immediately. The whole process from setup to viewing results is designed to be straightforward so you can focus on what the data tells you about user behavior.


Continue watching

Get in touch

Tell us what you're building. We reply within one working day. Jono or someone on the team picks up every message personally.

By sending this you agree to our privacy policy. We only use your details to reply.