Skip to main content
All CollectionsAdvanced topic
How to test conditionally to new and returning visitors?
How to test conditionally to new and returning visitors?
Leo avatar
Written by Leo
Updated over a week ago

When it comes to selling products, each store has different approaches. Some stores will have customers repeatedly visiting and making final purchases in the end. Some stores will only encounter the same customer once.

Hence, running tests only on new or returning customers might be helpful to improve the accuracy of testing.

This article will explain how to set up a test with this advanced option.

Currently, we have this feature for all of our following test types:

  • Price Test

  • Shipping Test

  • URL Redirect Test

  • Template Test

  • Theme Test

How does this advanced option work?

After the visitor label script is enabled, ABConvert will start recording the first visit time of each visitor in your store. Then differentiate visitors into new visitors or returning visitors based on their labeled first visit time and the time the test was created.

  • New visitor: The labeled first visit time is later than the test.

  • Returning visitor: The labeled first visit time is earlier than the test.

Let’s say we enabled the script on May 10 and started the price test on May 24.

  • Visitors A and C will be new visitors as their labeled first visit time is later than the price test.

    • Visitor A has visited the store before but the visit activities are not recorded before the script is enabled.

  • Visitor B will be a returning visitor as the labeled first visit time is earlier than the price test.

How to set up a test with the new and returning visitor filter?

Step 1: Enable visitor label script

To gather more data and be ready to start using the filter in the test at any time, we recommend keeping this script enabled.

Simply go to Online stores > Theme > Customize > App embeds, and you will find our visitor label script. Once you enable it, the script will start to label the first visit time of your customers.

Step 2: Give it some time to collect data

As we mentioned above, our script starts labeling the first visit time after the script is enabled. Therefore, we suggest starting a test at least two weeks later.

Otherwise, most returning visitors will be viewed as new visitors since their past activities are not recorded.

Step 3: Set up a test with -----

Price Test

If creating the price test, you can enable the filter and assign the test price (Original Price, Test Price, Random Price) to a specific group in the Advanced options.

Other Tests

If creating the other test types, you can apply the test to a specific visitor group by choosing one of the options (All, New Vistors, Returning Visitors) in the Audience targeting or Advanced options.

[Advanced Topic] How to preview the test with the new and returning visitor filter

Preview as a returning visitor

  • Visit your store

  • Open up the dev tool of the browser by right-clicking the page, then click “inspect“

  • Navigate to the console tab and use the following command to set the first visit timestamp to Jan 01, 1970.


  • Refresh the browser to see if the test is running correctly.

Preview as a new visitor

Simply visit your store in the incognito window, then you will be identified as a new visitor in the test.


If you want to test conditionally on new or return visitors:

  1. Turn on visitor label script in the theme editor.

  2. Wait for a period to label visitors' first visit time. (We recommend waiting for at least two weeks.)

  3. Start a test with the new and returning visitor filter.

If you encounter any issues, feel free to reach out to support through the intercom widget or write an email to [email protected].

Did this answer your question?