Device condition

Avatar

Avatar

Dave_hamel1

Avatar

Dave_hamel1

Dave_hamel1

22-11-2018

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Aaronius9er9er9

Employee

Avatar

Aaronius9er9er9

Employee

Aaronius9er9er9
Employee

26-11-2018

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.

Answers (10)

Answers (10)

Avatar

Avatar

StewSchilling

MVP

Avatar

StewSchilling

MVP

StewSchilling
MVP

28-11-2018

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

Avatar

Aaronius9er9er9

Employee

Avatar

Aaronius9er9er9

Employee

Aaronius9er9er9
Employee

28-11-2018

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

Avatar

Dave_hamel1

Avatar

Dave_hamel1

Dave_hamel1

06-12-2018

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.

Avatar

Avatar

Gigazelle

Employee

Total Posts

1.9K

Likes

459

Correct Answer

734

Avatar

Gigazelle

Employee

Total Posts

1.9K

Likes

459

Correct Answer

734
Gigazelle
Employee

03-12-2018

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

Avatar

Avatar

Dave_hamel1

Avatar

Dave_hamel1

Dave_hamel1

28-11-2018

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

Avatar

Avatar

Aaronius9er9er9

Employee

Avatar

Aaronius9er9er9

Employee

Aaronius9er9er9
Employee

28-11-2018

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

Avatar

Dave_hamel1

Avatar

Dave_hamel1

Dave_hamel1

28-11-2018

The site is responsive so screen size.

Avatar

Avatar

Aaronius9er9er9

Employee

Avatar

Aaronius9er9er9

Employee

Aaronius9er9er9
Employee

28-11-2018

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

Avatar

Avatar

Dave_hamel1

Avatar

Dave_hamel1

Dave_hamel1

28-11-2018

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

Avatar

StewSchilling

MVP

Avatar

StewSchilling

MVP

StewSchilling
MVP

24-11-2018

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

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