Mouseflow Help & Support

Track Visitors By Specific Device

Follow

With Mouseflow, it's easy to track specific devices. If you're only interested in tracking visitors that use their mobile or tablet to access your site, this is easily accomplished with a few of lines of code.

Track Tablet and Mobile Visitors

<script type="text/javascript">
// Largest screen size to track
if (window.innerWidth < 1024) {
  var _mfq = _mfq || [];
  (function() {
      var mf = document.createElement("script"); mf.type = "text/javascript"; mf.async = true;
      mf.src = "//cdn.mouseflow.com/projects/your-website-id.js";
      document.getElementsByTagName("head")[0].appendChild(mf);
  })();
// Don't forget the closing bracket
}
</script>

This example tests if the screen size is less than 1024 pixels wide (standard desktop screen width). If it is, a tracking session will start. You can change '1024' to any preferred value, depending on what screen width you're interested in.

Track Tablet Only Visitors

<script type="text/javascript">
// Range of screen sizes to track
if (window.innerWidth > 480 && window.innerWidth < 1024) {
  var _mfq = _mfq || [];
  (function() {
      var mf = document.createElement("script"); mf.type = "text/javascript"; mf.async = true;
      mf.src = "//cdn.mouseflow.com/projects/your-website-id.js";
      document.getElementsByTagName("head")[0].appendChild(mf);
  })();
// Don't forget the closing bracket
}
</script>

This example tests if the screen size is wider than 480 pixels (standard mobile screen width) and less than 1024 pixels (standard desktop screen width). If it is, a tracking session will start. You can change '480' and '1024' to any preferred value, depending on which screen widths you're interested in.

Track Mobile Only Visitors

<script type="text/javascript">
// Largest mobile screen size to track
if (window.innerWidth < 768) {
  var _mfq = _mfq || [];
  (function() {
      var mf = document.createElement("script"); mf.type = "text/javascript"; mf.async = true;
      mf.src = "//cdn.mouseflow.com/projects/your-website-id.js";
      document.getElementsByTagName("head")[0].appendChild(mf);
  })();
// Don't forget the closing bracket
}
</script>

This example tests if the screen size is less than 768 pixels wide (standard tablet screen width). If it is, a tracking session will start. You can change '768' to any preferred value, depending on what screen width you're interested in.

 

Tags: track mobile only track desktop only track tablet only record mobile screen size track specific device

Have more questions? Submit a request

Comments

Powered by Zendesk