All questions

Testing product hero images stored in Sanity, does the image live in Croct or Sanity?

Asked by Valeria Duarte on

VDValeria Duarte

i want to A/B test two product hero images against each other. What I cannot figure out from the docs is where the variant image actually lives. Is the second image URL stored in the Sanity document, in the Croct variant content, or in both places? And later, when a marketer wants to swap out the losing image, what exactly do they edit and where?

Was this helpful?

1 answer

Rrui_p

Only the default lives in Sanity. Think of it as two layers:

  • The Sanity document holds the canonical hero image. That is what renders for everyone outside the test, and it is the fallback when no experience applies or a fetch fails.
  • The challenger image is variant content inside the experiment. Variant content follows the slot's component schema, so if your hero component has an image field, each variant has that same field, and you paste the challenger's URL there.

You do not duplicate the control into Croct; the experiment layer only holds what differs.

On the workflow question: variant content is edited in the experience editor, no code change involved, so a marketer can swap the losing image or adjust the test themselves. An experiment holds 2 to 5 variants with a primary goal and a traffic allocation percentage, so a third image later is just another variant. If the challenger wins and you want it to become permanent, either roll the winner out from the experiment or update the Sanity document so the new image becomes the canonical default.

Was this helpful?
NHNadia Haddad

Late addition since I was searching for exactly this setup. The two-layer explanation matches what we found: the control image stays in the Sanity document, and the challenger URL goes in the variant content under the same image field from the slot's schema. One practical note for image tests specifically, keep both images at the same dimensions and aspect ratio, otherwise the layout shift between variants can confound the result you are trying to read. When our challenger won we just updated the Sanity document so it became the canonical default and left the experiment off.

Still have questions?