Analytics for mobile vs. desktop traffic

We have an analytics platform for our clients to understand where people are interacting with our extension.

We’d like to be able to break this down by mobile vs. desktop.

As we don’t have access to the window object, we can’t reliably tell if a user is on mobile or not. What alternatives are there for determining desktop vs. mobile usage? It doesn’t look like many of the options described by MDN here would work?

Two questions:

  1. Is there an official Shopify recommended way of achieving this?
  2. In the absence of the window object, while it’s imprecise, is it safe to assume that the navigator.userAgent is accessible? Is this known to be reliable enough for a best guess? Or could this be removed in the future?