This website works best with JavaScript enabled. Learn how to enable JavaScript.

Troubleshooting: Segmentation and Targeting Not Working

Last updated

If you are targeting your tests to a select audience group, visitors become part of the test only per the target or segment conditions. When a visitor becomes part of a test, VWO drops a cookie in the visitor browser to identify the visitor. This helps make sure that the visitor lands on the same variation on returning to the website later.For example, the segmentation has been set up with “Cookie value” as “test.” When the visitor becomes part of the test, the value of the cookie (test) is updated to 1.

  • If a visitor lands on the test URL, but does not have the “test” cookie in the browser, the corresponding visits are not tracked.
  • The visitor becomes part of the test when they land on the test page, and VWO reads the cookie.
  • After the cookie is updated, the visitor will continue to see the same variation even during every repeat visits regardless of the cookie being present in their browser.

To check the segmentation each time a campaign URL is opened, please add the following code before VWO tracking code on your test pages:

For single campaign:

<script type="text/javascript">

_vis_opt_check_segment = {'Test_ID': true}

</script>

For example, to check segmentation for campaign # 10, add the following code:

<script type="text/javascript">

_vis_opt_check_segment = {'10': true}

</script>

For multiple tests: 

<script type="text/javascript">

_vis_opt_check_segment = {'Test_ID1′: true,'Test_ID2': true}

</script>

For all tests in your account: 

<script type="text/javascript">

_vis_opt_check_segment = {'global': true}  

</script>

ATTENTION Add the code snippets only on the HTML test pages and not on the goal URLs. Also, note that the code works only for test segmentation. Variation targeting in Split tests or personalization is not supported.

Use-Cases for Adding Segmentation Code:

  • Setting up cookie-based segmentation for signed-in users: The URL for signed in and signed out users remains the same, but the value of the cookie changes. If a signed in user becomes part of the campaign once and gets the desired variation, he will still be part of the campaign and see the same variation on signing out.
  • Segmentation setup for new users: If a new user visits the page, he will become a part of the campaign. On revisiting the page, this user should not see the variation again as he will be a returning visitor this time. However, he will be a part of the campaign and will continue seeing the same variation.
  • Segmentation set up for desktop devices: If the campaign URL was opened once on a desktop, and then on the mobile emulator of the same browser, the variation will still be shown.

Was this article helpful?

Thanks for your feedback!
Please email us at support@vwo.com to tell us what you were looking for. We'll send the answer to your inbox.

Contact Us / Login