XF 1.5 Conditionals based on mobile or desktop?


I could use some advice.

Advertising is our only means of support. We use 4-5 ad networks in a daisy chain waterfall. Network A... if not filled, go to Network B, etc. This works great for desktop traffic. However, for the last few months, several users have complained about being on their phones and being redirected off of our site by a malicious ad (especially IPhone/Safari users). It's been very difficult to find the offending ad or network since I don't experience the issue.

So my question is: Is there a way I can display different advertising based on whether it's a mobile device or not? For example, if Xenforo has a conditional for a viewport and it's under a certain width, I could place a mobile-friendly ad tag. If not, go with the desktop tags.

Any insight or advice on this is greatly appreciated. Thank you!