Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
7.2.10 DXP: values to use in segment to distinguish smartphones?
(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
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
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.
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
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
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
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
Excellent tip! Thanks Christoph! :-)
Amazing attribution thank you
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
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
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™