After July 2021, the 2.3.x release line no longer received quality updates or user guide updates. PHP 7.3 reached end of support in December 2021, and Adobe Commerce 2.3.x reached end of support in September 2022. We strongly recommend upgrading to Adobe Commerce 2.4.x to help maintain PCI compliance.

Google Content Experiments

This site contains archived merchant documentation for a version of Adobe Commerce and Magento Open Source that has reached end-of-support. The documentation available here is intended for historical reference only and is not maintained. The Adobe Commerce Merchant Documentation for current releases is published on the Adobe Experience League.

The following example shows how to set up an A/B test of products, categories, or content pages using Google Analytics Content Experiments. We recommend that you keep two browser tabs open while working through the instructions, because you will need to bounce back and forth between the Magento Admin and your Google Analytics account.

Google Content Experiments has been deprecated and will eventually be replaced by Google Optimize.

Step 1. Enable Content Experiments (Magento)

  1. Log in to the Admin of your Magento installation.

  2. Follow the instructions to enable Google Analytics with Content Experiments in the Magento configuration.

    Sales configuration - Google Analytics Enable Content Experiments

Step 2. Set Up the Variations (Magento)

Create multiple variations of the same product, category, or page.

  • Each variation must have a unique URL key.
  • Each variation must have the same store view selected.

You can create up to ten variations of each entity that you want to test. For products, use Save & Duplicate to save time.

Step 3. Set Up the Experiment (Google)

You must have the appropriate permissions to the Google account to create an experiment.

  1. Open another browser tab, and log into your Google Analytics account. If necessary, navigate to the Account and Property.

  2. In the sidebar on the left, choose Admin. Then, do one of the following:

    Choose an Existing View

    In the header of the View column, click the down arrow, and choose the view that is to provide the data for the experiment.

    Create a New Reporting View

    • In the header of the View column, click Create View. Then, do the following:

      • Identify the experiment location as either “Website” or “Mobile app”.

      • Enter a descriptive Reporting View Name.

      • Specify the Reporting Time Zone.

    • When complete, click Create View. Then, click the back arrow to return to the previous page.

      Google Analytics - content experiments reporting New Reporting View

  3. In the left panel under Reports, choose Behavior > Experiments.

  4. Click Create experiment. Then, do the following:

    • Specify the percentage of traffic to redirect.

    • Specify the Original Page URL and the URLs of each page variation that you want to test.

    • Complete the other options. If you need help see Configure & Modify Experiments.

  5. When the experiment is set up, click Manually Insert the Code. Then, copy the code snippet.

Step 4. Paste Code Snippet (Magento)

  1. Return to the Admin of your Magento installation. Then, open the original version of the product, category, or page in edit mode.

  2. Expand the View Optimization section for the product, category, or page.

  3. Paste the code snippet that you copied from Google Analytics into the Experiment Code text box.

    Do not paste the code snippet into any of the variations.

    Product view optimization Product View Optimization

  4. When complete, click Save.

Step 5: Review and Start the Experiment (Google)

  1. Return to your Google Analytics account.

  2. Review the experiment settings.

  3. If ready to begin, click Start Experiment. Otherwise, click Save for Later.