Visitor attributes criterion

The Visitor attributes criterion is a segmentation criterion that enables you to create a segment. 

 📖 Definition

The Visitor Attributes criterion enables you to create a segment based on a previously created set of variables and values, based on visited pages’ URLs. The variables are created and declared inside the visitors’ attributes setting pages in the Settings menu of AB Tasty, or directly from your code base. 

⚙️ Configuration

In the Settings

To configure visitor attributes based on specific visited URLs, apply the following steps:


  1. Click Guide_Segments_Criteria_37.png , to access the global AB Tasty menu. Then, click Settings > Advanced settings > Visitor attributes
  2. In the first dropdown list, select your matching method from the following two options

    - Contains: every URL that contains the declared element will generate an attribute

    - Regular expression: you can use this method to combine multiple URL elements

  3. In the URL field, enter the URL of the page.
  4. In the Variable name field, enter the name of your variable/key.
  5. In the Variable value field, enter the value you want to give to your variable/key.
  6. Then validate by clicking Add: the Visitor attribute is saved and is usable inside the targeting.  

For instance, in the above example, we want to create an attribute to identify all logged visitors. We will base our identification on the successful login page that we assume, according to your website user flow, every visitor visits during the login process. To do this, we can go through the following steps:

  1. In the Choose matching method field, select contains.
  2. In the Url field, enter /login-success.
  3. In the Variable name field, enter userType.
  4. In the Variable value field, enter loggedVisitors.
  5. Click Add.

A visitor attribute can be deleted by clicking the trash icon. 

To configure visitor attributes based on data you will send to the AB Tasty tag, you need to use a specific type of hit as described in our technical documentation. The common structure of the Segment hit is as follows:

window.abtasty.send("segment", {
 s: {
   key1: value1,
   key2: value2

A Segment hit is composed of a set of Visitor Attributes, as shown in the image below:


AB Tasty is then able to receive and reuse those visitor attributes. The first entry of the tab will be the variable and the second will be the value.

To do this, apply the following steps:

  1. Copy the segment hit code snippet and paste it into your code base. Call the function as many times as you need to send data to AB Tasty depending on which scenario you want to use in terms of targeting and visitor attributes.
  2. Adapt it to suit the keys and values you want to define. Make sure to declare the right value according to your user journey and context on your website.

You can find your configured visitor attributes in our campaign reports.

In the Targeting step

Let’s say you want to target the women who visit your website. You’ve previously configured a “visitor attribute” in your account settings to identify them based on a specific action on the website (viewing of a characteristic page, for instance).
You now need to enter the name and value of this previously configured variable. In the following example, we are using the UserSex variable, previously configured in the account settings. 

You can use several visitor attributes to create your segment, choosing if you want to match some (if you want users to have carried out one action related to the variables) or all the conditions (if you want users to have carried out all the actions related to the variables).

 💡 Use case

This segmentation criterion is multifaceted. However, it requires you to have previously come up with a possible overlap between events that occur on the website and the inclusion in a given segment.  Here are a few examples and possible use cases:
- visitors who have clicked “subscribe to newsletter” => “subscribed” segment => campaign to hide newsletter subscription modals and streamline browsing experience
- visitors who have viewed 10 pages in the “childcare” section of your website => “Baby Appetence” segment => campaign to promote the baby registry service
- visitorsUserSex = Female AND Appetence = Men_accessories => “Partnered women” segment => Valentine’s day gift campaign.

🔎 How Does It Work?

Within the tag, we created an object called ABTastyData, that contains information about your visitors’ journey. Inside this object, we store the information visitor attributes data in locations called CV and segments. This is performed once you configured some in your AB Tasty account, and once the tag receives hits from this configuration.


Need additional information?

Submit your request at

Always happy to help! 


Was this article helpful?