What We Built
In this example, we built a widget that enables you to A/B test multiple variations of content on your site. Variations are automatically assigned to visitors, ensuring each person receives the same version of the test—no matter how often they visit your site. Additionally, the widget tracks events, like clicks per variation, and sends the data to analytic tools, like Google Analytics or Mixpanel. You can use this data to get a better understanding of visitor behaviors and optimize your site performance.
Note: Google Data Studios (GDS) supports Wix data sources only for domain-connected Premium sites. Find out more about using GDS with Wix.
How We Built It
We added a box slideshow element to our mediaBox. The slideshow works as a container for the variants we want to test. We used two slides for the A/B test, making minor changes to the design of each slide. Then we changed the slideshow settings, turning off “Autoplay on load”. This ensures visitors only see one variant of the test.
We added the following property to our widget:
tableName: This property sets the name that will appear in the Untitled Data Source page of GDS.
Using the bucketify() function, assign a userID and testing variation for each visitor.
To track visitor actions, use the trackEvent method from the wix-window API. In this example, we tracked button clicks for each variant in the test.
Use the data from GDS to get a better understanding of which variants perform better and make necessary changes to your site.
Find all the information you need to get started on your next web component.