Expand my Community achievements bar.

Announcement: Calling all learners and mentors! Applications are now open for the Adobe Analytics 2024 Mentorship Program! Come learn from the best to prepare for an official certification in Adobe Analytics.

Add Mobile Screen Density as an OOTB Adobe Analytics dimension for mobile

Avatar

Level 2

4/3/23

Description -

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. 

Current Behaviour -  This is not an ootb dimension

1 Comment

Avatar

Community Advisor

4/6/23

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:

  1. 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).

  2. 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;
    }

  3. 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


  4. Track the custom dimension: Ensure that your tracking calls include the custom dimension so that it gets captured in Adobe Analytics.