All things Shopify and commerce
Hi!
I would like to A/B test my CTA by changing the colour of it. How can I display 2 different colours of the Add to Cart button in order to run an A/B test? Any ideas?
Thanks!
Solved! Go to the solution
This is an accepted solution.
A good alternative to Google Optimize is VWO. If your website has <50k users, this is best as it provides Free Plan for users <50k
You could add a custom code snippet to your Theme code files for the "Add to Cart" button that overwrites the style of the default "Add to Cart" button or adds a class to it that defines specific CSS for the color/style of the button. You can generate a random number 0 or 1 and based on that, apply specific styles/classes.
PS! This will not persist throughout the customer journey between pages so some pages will have "Add to Cart" buttons of a different color than they saw on a previous page. If you want the color to persist between pages then you need to save the random number that you generated on the first page load in your page's Local Storage or Cookies.
Hi, Spy!
Thanks for the answer. Can you detail the second part of your message, please? The idea would be to have the same Add to Cart colour across the website for the same user. However, another user should have another colour. This is how I would like to perform the A/B Testing. Do you feel something like that is possible?
Hi @PurplePartner ,
Creating a proper A/B test requires use of 3rd party tools. Google Optimize is a good tool that Google Provides which we can use to create a test. We can connect this test with Google Analytics and compare reports between multiple variants.
However you are a little late to use Google Optimize. This is because Google Optimize will be available till september 30 only as this feature is being shut down by google. If you are expert in JS you can still use this to create A/B Test which can last for a week till 30th september.
Ref: https://support.google.com/optimize/answer/12979939?hl=en
All other tools are paid.
If you need to be done ASAP, feel free to contact me.
Since Google Optimize will be deactivated, what other options do you recommend?
This is an accepted solution.
A good alternative to Google Optimize is VWO. If your website has <50k users, this is best as it provides Free Plan for users <50k
Thanks! I will mark this as a solution.
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025