Expand my Community achievements bar.

SOLVED

Device condition

Avatar

Level 4

Hello,

I need to create a rule that only fires for desktop (not mobile)  but when I try to use the Device Type condition Launch tells me not to.  What should I be doing instead?

condition.png

1 Accepted Solution

Avatar

Correct answer by
Employee

Thanks for the question Dave.hamel​. The reason the Device Type condition is no longer supported is largely because the definition of certain "device types" has become very blurry in recent years. For example, what do you consider "desktop" these days?

If the device supports a mouse instead of touch? What if it supports both (e.g., Microsoft Surface)?


If the device screen is a certain resolution? What resolution would be the threshold? What about large difference in pixel density?

Whether the user is on a phone network? What if it's a phone connected to a wireless router?

With the above questions in mind, your definition of a desktop may be wildly different than that of other website owners. I would try to define what you mean by "desktop" and then you may end up needing to write a Custom Code condition or use a library like stewarts16448458​ suggests in order to target whatever your definition entails.

View solution in original post

11 Replies

Avatar

Community Advisor

This is total overkill for your scenario, but it's a solid solution.

https://www.scientiamobile.com/products/wurfl-js/

Avatar

Correct answer by
Employee

Thanks for the question Dave.hamel​. The reason the Device Type condition is no longer supported is largely because the definition of certain "device types" has become very blurry in recent years. For example, what do you consider "desktop" these days?

If the device supports a mouse instead of touch? What if it supports both (e.g., Microsoft Surface)?


If the device screen is a certain resolution? What resolution would be the threshold? What about large difference in pixel density?

Whether the user is on a phone network? What if it's a phone connected to a wireless router?

With the above questions in mind, your definition of a desktop may be wildly different than that of other website owners. I would try to define what you mean by "desktop" and then you may end up needing to write a Custom Code condition or use a library like stewarts16448458​ suggests in order to target whatever your definition entails.

Avatar

Level 4

Aaronius9er9er9er​  Here is the scenario I am trying to resolve.  We have a tool which we would like to include on the pages. Let's say it's something like Clicktale, which comprises of a separate JS which I am injecting with Launch.  However, we don't want to include it on mobile versions of a particular landing page because it is weighty and slows things down.  I can do an exclusion for the URL but that would be overkill, and we still want the tool to run on desktop versions.  I only want to remove it from a mobile version of that page.

I considered duplicating the rule and having one for all other pages and one for this specific marketing page.  Then removing it  from the mobile version of this page with a condition.

Thoughts?

Avatar

Employee

How do you determine if the user is viewing a "mobile version" of the page?

Avatar

Level 4

The site is responsive so screen size.

Avatar

Employee

You'll want to make sure it's really responsive to screen size (resolution) and not window size. It could be either one. You can determine which it is by opening the site on your desktop and shrinking the window. If it flips to the "mobile version" at some point as the window is made smaller, the site is actually responsive to window size and not screen size.

If it's screen size, I would use the Screen Resolution condition from the Core extension. If it's window size, I would use the Window Size condition from the Core extension. If the size is greater than whatever your threshold is, load your tool; otherwise, don't load your tool.

Avatar

Level 4

That makes sense, but what if I only what that screen size functionality to apply for a single page. 

Avatar

Employee

Until our rule builder supports ORing conditions, I'm afraid you have to do what you were referring to previously:

If you don't want to have to maintain the tool-loading code in two different rules, you could create a third rule that uses a Direct Call event and loads the tool in an action and then call that rule from your other two rules that have the URL and window/screen size conditional logic.

thebenrobb​ Here's another data point where ORing functionality would simplify the user experience ^^^

Avatar

Community Advisor

One other option might be to put your desktop and mobile content on a CDN that can do device detection and serve up optimized content. 

Something like this:

Caching Content Based on Request Headers - Amazon CloudFront

I'm sure that Akamai and most any other modern CDN can do the same thing.

Avatar

Employee Advisor

Hi David, were you able to make progress with your rule in Launch? I'd love to hear what you ended up doing.

Avatar

Level 4

Hi Gigazelle,

So after much discussion we decided to leave the code on, so the problem went away. But it got me thinking, really what we were after was a way to turn rules off for connections that are slower.  So that if someone is on a 3G connection, they don't get all the bells and whistles, just the base analytics regardless of what the device is.