A/B testing is one of the most valuable tools for e-commerce marketers that allows them to track what page option sells more. Magento 2 offers you the possibility to create tests with the help of Google Analytics. Let’s see how to run an experiment.
Useful Tip: before starting an experiment, make sure that your website has a good loading speed. A/B testing tools can slow down your store creating an additional burden in loading. To avoid issues with speed loading, we recommend implementing the Google Page Speed Optimizer extension before running a/b tests. This plugin optimizes the HTML code, reduces the number of requests to the server by merging and minifying CSS and JS files, resizes images without losing the quality and allows you to enable the lazy loading.
First of all, make sure that you have added Google Analytics e-commerce tracking to your Magento 2 store. For this, log in to your admin panel and navigate to Stores > Settings > Configuration. Open the Sales tab and click on the Google API. The settings should be the following:
The last setting answers for A/B testing, so if it was disabled previously, enable it now.
Note: if you have any problems with implementing Google Analytics in Magento 2, check our detailed step-by-step guide on how to add GA to Magento 2.
Next, you need to create an alternative option product, category, or page that you want to test. Pay attention to URL and store views. Each variant should belong to the same store view and have a unique URL. It’s possible to create up to 10 variations.
When you are ready to launch an experiment, open your Google Analytics account in the adjacent tab, and follow the steps:
Step 1. Choose Admin from the left menu.
Step 2. Then you have two options: you can choose one of the existing views or create a new one. If you already have the needed view for your experiment, navigate to the View column, and choose the needed view from the dropdown.
To create a New Reporting View, go to the View column and click on the Create View button. Then, you need to choose the experiment location, fill in the Reporting View Name, and select your Reporting Time Zone from the dropdown. Click on the Create View button and go back to the previous page.
Step 3. Next, go to Reports > Behavior > Experiments and clinic on the Create Experiment button.
Step 4. Enter the Name of the experiment. To see the results of testing Magento 2 page in Google Analytics e-commerce tracker, you need to select the Objective for the experiment from the dropdown or create a new one.
Step 5. Set the percentage of traffic that should be redirected to the new view. Turn on email notifications, if needed.
Step 6. Move to the next step and configure your experiment. Enter the Original Page URL and page variations. Don’t forget to save the changes.
Step 7. Next, Google Analytics will ask you to implement the code. For this, go back to your Magento 2 backend and go to the original page of the product or category. Open the View Optimization tab and paste the code provided by GA in the Experiment Code field. Then save the changes.
Step 8. Go back to your GA for the final step. Double-check the experiment configurations and click the Start Experiment button.
After launching the experiment, you can see the results in your e-commerce tracker and analyze what Magento 2 page is more attractive for your users.