Join us for the next Community Q&A Coffee Break on Tuesday April 23, 2024 with Eric Matisoff, Principal Evangelist, Analytics & Data Science, who will join us to discuss all the big news and announcements from Summit 2024!
Why is this feature important to you - Knowing the density of a mobile device (DPI, Dots per Inch) is helpful for mobile developers to understand the requirements of the app users.
How would you like the feature to work - An additional mobile dimension named something like "Mobile Screen Density" would capture the dpi of the device a visitor uses.
Adobe Analytics does not currently have an out-of-the-box (OOTB) dimension for mobile screen density (DPI). However, you can still capture this information by implementing a custom dimension, such as an eVar or a prop, and setting it with the device's DPI value using custom JavaScript code.
Here's an example of how you can implement this:
Create a custom dimension: In Adobe Analytics, create a new custom dimension, such as an eVar or a prop, to store the mobile screen density value. Make a note of the eVar or prop number you create (e.g., eVarX or propX).
Capture screen density using Javascript: You can use JavaScript to calculate the device's screen density (DPI) with the following code:
function getDeviceDPI() { return window.devicePixelRatio * 96; }
Set the custom dimension value: In your Adobe Analytics AppMeasurement.js file or in the Adobe Launch interface, set the custom dimension (eVar or prop) to the value obtained from the JavaScript function:
s.eVarX = getDeviceDPI(); // Replace "eVarX" with your actual eVar number // OR s.propX = getDeviceDPI(); // Replace "propX" with your actual prop number
Track the custom dimension: Ensure that your tracking calls include the custom dimension so that it gets captured in Adobe Analytics.