# Device criterion

The Device criterion is both a segmentation criterion and a triggering criterion.\
It enables you to create a [segment](/assets-library/creating-and-managing-segments.md) or a [trigger](/assets-library/creating-and-managing-triggers.md).\
To learn how to create a segment, please refer to this [article](/web-experimentation-and-personalization/targeting-step/how-to-create-a-segment-who-section.md).\
To learn how to create a trigger, please refer to this [article](/assets-library/creating-and-managing-triggers.md).

## 📖 Definition <a href="#h_01hhm80307324bnj8gq904skzk" id="h_01hhm80307324bnj8gq904skzk"></a>

The Device criterion enables you to restrict the visibility of a campaign to visitors based on the device they are using for their current session.

## 🔎 How does it work? <a href="#h_01hggw9c473a3dy0kd6vhya90z" id="h_01hggw9c473a3dy0kd6vhya90z"></a>

We store the device information in the Session storage inside the `ABTastyUA` location. We call a specific service on our side to write and assign a value inside that variable, usually when the first page of the session loads. Three values are assignable:

* ‘Mobile phone’
* ‘Tablet’
* ‘Desktop’

{% hint style="info" %}
When you manually QA a campaign, make sure to clear your storage if you artificially change your user agent (using the mobile mode from the browser for example). That way, AB Tasty will assign a new value in ‘ABTastyUA’ as it was your first visit.
{% endhint %}

To interpret the browser user agent, AB Tasty uses an external service called “[Yauaa](https://yauaa.basjes.nl/)”, which allow us to do the conversion between the user agent and our homemade values.

## ⚙️ Configuration <a href="#h_01hhm80308zbc9nsfsjfvb5b7q" id="h_01hhm80308zbc9nsfsjfvb5b7q"></a>

The configuration of the Device criterion is the same for segments and triggers.\
When you are using this criteria, you need to choose between two operators :

* **`Is`:** will include the selected value
* **`Is not`:** will exclude the selected value

Then, select the device you want to include or exclude (according to your previous selection) in the second dropdown list:

* **On mobile:** users using their mobile device when visiting your website
* **On tablet:** users using their tablet device when visiting your website
* **On desktop:** users using their desktop when visiting your website

To include two devices, you need to exclude the third one.\
For example, if you want to target users on *mobile* and *tablet*, you need to exclude *desktop* visitors.

<img src="/files/UlEM0hYKERdKlNcXSkwe" alt="" width="563">

On the contrary, if you want to exclude two devices, you need to include the third one.\
In this example, *mobile* visitors are included. Therefore, *desktop* and *tablet* visitors are excluded from the targeting.

<figure><img src="/files/qx9QxYAoxZDloj8SI4gr" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="warning" %}
Visitors browsing on tablet using Safari are recognized as desktop visitors. In this case, we recommend adding a [Screen size criterion](/assets-library/creating-and-managing-triggers/list-of-trigger-criteria/screen-size-criterion.md) to include or exclude these visitors.
{% endhint %}

## 💡 Use case <a href="#h_01hhm80308ajt2ynf8839yg5gg" id="h_01hhm80308ajt2ynf8839yg5gg"></a>

If you have a mobile application, you may want to display a message encouraging users of the mobile website to download the mobile application. In this case you need to display the campaign to mobile users only. To do so, select *is* > *on mobile* in the segment of your campaign.

**Need additional information?**

Submit your request at <product.feedback@abtasty.com>

Always happy to help!

<img src="/files/c6zvQFGbgGTtmVXhcv8X" alt="" width="146">


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.abtasty.com/assets-library/creating-and-managing-segments/list-of-segment-criteria/device-criterion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
