Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Generic device profiles based on max screen size View modes: 
User avatar
Member
Member
pnmcosta - 1/15/2014 9:25:50 AM
   
Generic device profiles based on max screen size
Hi All,

I'm trying to setup generic device profiles for Tablet and Mobile based on the max screen size instead of user agent/device but am encountering a few issues.

I've setup 2 profiles as follows:

User image

But when I visit the site unauthenticated or not on preview mode, both devices are picked instead of the default layout:

User image

Whereas on Preview/Logged in to CMSDesk it works just fine:

User image

Am I missing something? Or could this be a bug? I'm using v7.0.70, the template and the page are published and there's no workflow or check/check out enabled.

Many thanks for any help in advance.

Cheers,
P.

P.s. Permission is also set to Read for Public Anonymous User (public) on the Root node and the page is properly inheriting it.

User avatar
Member
Member
pnmcosta - 1/17/2014 7:51:54 AM
   
RE:Generic device profiles based on max screen size
Hi,

Obviously, i'm assuming the user agent is being parsed into a Device and detected before the width rule condition is triggered. Or is that not the case?

At least it works when on Preview/Logged in to CMSDesk!

If so is there a fixed list of devices, or could someone export their device profiles? :)

Thanks,
P.

User avatar
Member
Member
kentico_sandroj - 1/17/2014 1:29:37 PM
   
RE:Generic device profiles based on max screen size
Hello,

There seems to be some type of issue with using sizes in the macro designer, I was able to reproduce this issue. I will provide this information to the developers and post an update once I receive a reply. In the meantime, there are other rules that seem to be working as expected. Would it be an option to use something like IsTablet or IsMobile while we work on resolving this issue? You also have the option of downloading device profiles such as 51degrees.

Please let me know if you have any questions.

Best Regards,
Sandro

User avatar
Member
Member
kentico_sandroj - 1/24/2014 5:36:42 PM
   
RE:Generic device profiles based on max screen size
Hello,

An update on this situation - we were wondering if you own the 51Degrees.mobi premium data?

Also, would it be possible to provide the macro debug log entries related to resolving of the macro rule?

Additionally, once you have the logs, if possible please try to:

1. Clear browser cookies, refresh the page and check BODY element classes whether there is more then one device class.
2. Try to change size range in macro rule for the larger device to 641-768 pixels.
3. Check the Body element class

Please let me know if you have any questions.

Best Regards,
Sandro

User avatar
Member
Member
pnmcosta - 2/6/2014 5:07:46 AM
   
RE:Generic device profiles based on max screen size
Hi Sandro,

We did do the test you mention and using isTable or isMobile appeared to have fixed our issue.

However, we've come to realize that iPads are being recognized as mobile? Can you confirm this is because we are not using the 51Degrees.mobi premium data? Or is it an issue with Kentico?

Please advise, we wouldn't want to spend getting the 51Degrees.mobi premium data and it not fixing our issue.

Thanks,
P.

User avatar
Member
Member
ezelewsky-lbpc - 2/10/2014 3:27:41 PM
   
RE:Generic device profiles based on max screen size
We ran into similar issues with a device profile explicitly for iPads. The main problem is the iOS user agent which calls itself "mobile" for both iPad and iPhone. Check out Useragentstring.com for the latest iPhone and iPad user agents.

In our case, we're now using a macro to call out iPads specifically. Combining that with an "or" macro for all tablets in your situation may help.
CurrentDevice.UserAgent.contains("ipad") || CurrentDevice.UserAgent.contains("tablet")

You also may have to exclude iPads from the mobile side.

User avatar
Member
Member
pnmcosta - 2/12/2014 1:43:25 PM
   
RE:Generic device profiles based on max screen size
Thanks, this has helped, however other tablets are affected as well.

User avatar
Member
Member
steve - 2/6/2014 3:33:51 PM
   
RE:Generic device profiles based on max screen size
I'm experiencing the same issue. Is the integration with 51Degrees.mobi a requirement to utilize the CurrentDevice.ScreenPixelsWidth and CurrentDevice.MaxScreenSize macros?

If I use CurrentDevice.IsTablet I have phones that return as true and if I use CurrentDevice.IsMobile all tablets return as true. The only device profiles that seem to work correctly are the user agent specific versions.

Is it possible to implement a screen size specific profile without integration with 51Degrees.mobi?

Thanks!
Steve

User avatar
Member
Member
kentico_sandroj - 2/7/2014 2:50:54 PM
   
RE:Generic device profiles based on max screen size
Hello,

I am currently looking into the issue with using IsTable and IsMobile but we found that Device database provided by 51D didn't contain information for user agents of latest browser versions and MaxSideSize of the current device was equal to 0. Therefore macro rule condition was met only for Mobile device profile in hotfixes prior to 59.

But, In hotfix #59, 51D database was updated and MaxSideSize of the browser equals to 640 px. That's the marginal value for both device profiles. BETWEEN macro method matches the value with values in a given interval including its boundaries. Setting MaxSideSize of the both profiles to disjunctive intervals may be the solution. Would it be possible to confirm if that is the case on hotfixes later than 58?

User avatar
Member
Member
steve - 2/14/2014 8:49:25 AM
   
RE:Generic device profiles based on max screen size
I signed up for a free two week trial of 51Degrees.mobi to test with premium data. According to their documentation, IsTablet (along with ScreenPixelsHeight and ScreenPixelsWidth) is only available with the premium data. Also, gaining a better understanding of how 51D defines IsMobile and IsTablet helped me a bit:

IsMobile
The device's primary data connection is wireless and is designed to operate mostly from battery power (ie a mobile phone, smart phone or tablet)
This explains why tablets return as true. Also, since implementing the premium data, all phones are now returning as false for IsTablet.

IsTablet - (Only included with 51Degrees.mobi premium data)
The manufacturer of the device sells the device primarily as a tablet.
Note, Samsung Galaxy Tab (Android), Samsung Galaxy Note (Android), Google Nexus 7 (Android) all report false for IsTablet.

Another note, 51D does not provide any information regarding MaxSideSize on their properties dictionary found here:
http://51degrees.com/Products/DeviceData/PropertyDictionary.aspx

Could this property have been discontinued?

Overall, the goal I'm attempting to achieve is RESS - Responsive Design + Server Side Components:
http://www.lukew.com/ff/entry.asp?1392

Ultimately this technique means somehow detecting if the user is on a phone and serving different/optimized code to them via Device Profiles, Conditional and Device Layouts.

What I'm struggling specifically is how to detect if the user is on a phone. My approach was to use ScreenPixelsWidth or MaxScreenSize, but neither of those seem to consistently return correct values (many devices incorrectly return 640). I'm not entirely sure why this is.

I hope some of this helps, let me know if you would like any of the data files provides by 51D.

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 2/28/2014 2:40:49 AM
   
RE:Generic device profiles based on max screen size
Hi Steve,

I am not sure if this is related to the issue we were solving over the e-mails, correct me if I am wrong.
If it is related, the issue Steve had was wrong order of the device profiles where the macro used for the first profile in the list was evaluated as true so, Kentico is looking for first match and this caused the inconsistent results.

Best regards,
Juraj Ondrus

User avatar
Member
Member
steve - 3/10/2014 12:40:40 PM
   
RE:Generic device profiles based on max screen size
That is correct, thank you for your help Juraj! The device order made a difference, but my core issue was that one of my device macros was incorrectly returning as true for two separate device types, which was my fault. I never had any success with the MaxScreenSize, that method just didn't prove to be accurate enough for my purposes.

I used the following macros for detecting my device types (Desktop, Tablet, Phone)

Phone
CurrentDevice.IsMobile && !CurrentDevice.IsTablet

Tablet
CurrentDevice.IsTablet

Desktop
!CurrentDevice.IsMobile