Skip to content

Collect information about screen resolution #35

Open
alexbruy wants to merge 5 commits intoexplodingcamera:mainfrom
alexbruy:collect-screen-size
Open

Collect information about screen resolution #35
alexbruy wants to merge 5 commits intoexplodingcamera:mainfrom
alexbruy:collect-screen-size

Conversation

@alexbruy
Copy link

Currently Liwan only distinguish between desktop and mobile clients, and does not provide any insight on the visitor's screen sizes/resolution. Knowing most used screen size for instance can help with defining breakpoints and creating optimized images.

In this PR I tried to add support for screen size tracking. I'm new to Rust, so my code probably not that good.

Also, as I have no experience with Astro and TS, Gemini helped me to understand which changes are necessary on the frontend (dashboard) side. I hope I got them right.

@explodingcamera
Copy link
Owner

Thanks for submitting a PR! I'm a bit unsure about adding this, similarly to #23 I want to minimize the amount of data that could be used for fingerprinting.

I'll have to think about this a bit, something that might work would be having a set of predefined screen width buckets (or maybe devicePixelRatio * width) that are collected instead.

@alexbruy
Copy link
Author

alexbruy commented Mar 26, 2026

Thanks for the feedback!

I completely understand the concerns regarding fingerprinting. Liwan’s strict focus on privacy is exactly why I chose it and want to contribute to it.

Regarding screen resolution, my goal is to provide necessary insights for design, especially for defining CSS breakpoints and optimizing image assets, which is difficult to do with only a "Mobile/Desktop" breakdown.

To address the fingerprinting concerns while still providing useful data, I would be happy to implement the bucketing approach as you suggested. Instead of storing raw pixel values, we could define a few groups based on common widths, such as:

  • Mobile: 320px, 375px, 414px
  • Tablet: 768px, 1024px
  • Desktop: 1280px, 1440px, 1920px, 2560px
  • Ultrawide/4K: > 2560px

Other privacy-focused tools like GoatCounter, Counter.dev and others include screen size because it is an important metric for UI/UX, but they often use similar grouping or rounding to protect anonymity.

Would you be open to a revised approach where I either implement a helper to "fit" the resolution to the nearest bucket or store only the width, as height is often more variable and less critical for breakpoints planning?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants