RE: 7.2.10 DXP: values to use in segment to distinguish smartphones?

thumbnail
Fernando Fernandez, modified 5 Years ago. Expert Posts: 401 Join Date: 8/22/07 Recent Posts
(moved from a different thread)
Hi all,

I'm trying to make my first case of user segmentation and I'm failing on a simple task: I want to display 2 different versions of a page based on screen width.
I created a "Smartphones" segment with a session property like "Device Screen Resolution Width less than 500.00". Then I created a page with two different experiences - one  "default" with a single paragraph saying "Anyone"; the other with a paragraph saying "Smartphones", for audience="Smartphones" . Unfortunately, I'm unable to make this work, and refreshing the page with different browser widths does not change the output.
Any idea on what values should I use on the segment to make this work?
TIA
Fernando
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
Do you have wurfl installed? I think, it is a prerequisite for device detection. I am not sure here and might be totally wrong. I never used that feature.
thumbnail
Fernando Fernandez, modified 5 Years ago. Expert Posts: 401 Join Date: 8/22/07 Recent Posts
Thanks Christoph,
Never knew Liferay was using it but, anyway,  I'm only trying to use the display width, which any browser will  easily give  away... :-) 
I'm using Liferay 7.2 (tried both the DXP trial and the GA2 CE). Mobile detection seems to be installed but, again, I don't think it should be necessary to detect window size...
Fernando
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
The browser obviously knows the window size, but the server doesn't. The browser doesn't send that info to the Liferay server. It only sends a device dependent string (basically "I am an iPhone 5"). To determine the screen size of an iPhone or some Android device, a database is needed where the server can lookup the width/height of a device.
If you only need to know if it is a smartphone, maybe you can just check the user agent. AFAIK the user agent always contains the string "Mobile" for smartphones.
https://deviceatlas.com/blog/list-of-user-agent-strings
thumbnail
Fernando Fernandez, modified 5 Years ago. Expert Posts: 401 Join Date: 8/22/07 Recent Posts
Excellent tip! Thanks Christoph! :-)
zara rafdh, modified 5 Years ago. New Member Posts: 4 Join Date: 1/24/20 Recent Posts
Amazing attribution thank you 
Bobby Turner, modified 4 Years ago. New Member Post: 1 Join Date: 10/9/20 Recent Posts
Hiii,
Thanks Christoph,
Never knew Liferay was using it but, anyway,  I'm only trying to use the display width, which any browser will  easily give  away <!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}-->GarageBand PC