UXWizz
Searchโ€ฆ
Saving session device type
Example of storing custom device type data using tags.
If you want more granular device type data to be stored (e.g. mobile/tablet/desktop or Android/iOS/Windows/MacOS) and used to filter sessions, you can manually store extra device data for each session using Tags.
Note: The device type is sometimes hard to define, for example nowadays laptops can have a touchscreen or tablets can have keyboards and mouse and be used as laptops, the so called 2-in-1 devices (e.g. Microsoft Surface).
You should include this script tag after the included UXWizz tracking snippet.
Store device type as tag
1
<script>
2
(function() {
3
// Generic function to get device type based on UA string
4
function deviceType() {
5
const ua = navigator.userAgent;
6
if (/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(ua)) {
7
return "tablet";
8
}
9
else if (/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(ua)) {
10
return "mobile";
11
}
12
return "desktop";
13
};
14
โ€‹
15
// Store the device type as a tag, e.g. "device-mobile"
16
UST.addTag('device-' + deviceType());
17
})();
18
</script>
Copied!
By default UXWizz does store the device type in the ust_clients table under the device-type column, but only stores 0 for desktop devices and 1 for mobile devices (no difference is made for tablets).
Copy link