Change screen_size to use browser user agent - #1659
Conversation
|
thanks for your contribution @eriknakata! @ukutaht can add more details. our idea for how to improve this section was:
in the ui, we would need to retitle "Size" to "Device" in the tab itself and "Screen size" to "Device" in the header when the tab is open. and then remove the tooltip that shows up on the hover and tells you the screen size in px. |
|
hey @metmarkosaric, What's the name of the group combination of desktop and laptop ? How you are going to work with old data ? |
"Desktop" makes most sense I think
@ukutaht is best to answer this one |
|
Maybe run a script to update Laptop to Desktop |
|
hey @metmarkosaric I see a filter "screen size is Desktop". Should I change screen size to Device as well ? |
ukutaht
left a comment
There was a problem hiding this comment.
Looks good to me. Just a few things.
- Comment below about going through all the possible device types exhaustively
- Dealing with old data: yes let's create a database migration to change Laptop to Desktop. I can help with that if needed.
- Screen width tracking can be removed completely from the tracking script
| defp calculate_screen_size(width) when width < 992, do: "Tablet" | ||
| defp calculate_screen_size(width) when width < 1440, do: "Laptop" | ||
| defp calculate_screen_size(width) when width >= 1440, do: "Desktop" | ||
| defp calculate_screen_size(%UAInspector.Result{ |
There was a problem hiding this comment.
We should go through the list of device types in `matomo/device-detector' exhaustively. They have a 'phablet' device type for example, which would be classified by this as 'Desktop' which is incorrect.
|
Hey 👋 This PR has conflicts and I wanted to make some changes. Closing this in favour of #2680 for now |

Changes
Change how the screen size is calculated. The library UA inspector is already used by the project. So is possible use it to calculate the screen size. If not founded by the UA inspector the mechanism of calculate from screen_width is used as a kind of fallback. The existent function is still used to calculate Desktop and Laptop devices.
Original discussion: #157
Tests
Changelog
Documentation
Dark mode