ash-jc-allen / short-url

A Laravel package for creating shortened URLs for your web apps.
MIT License
1.25k stars 157 forks source link

Browser information being stored as `0` (`false`) when not available in headers #243

Closed stevebauman closed 4 months ago

stevebauman commented 6 months ago

Some of our Short URL visits contain zeros in their browser fields due to some visits being made by browsers not sending a user agent. This causes Jenssegers Agent to return false from its user-agent methods, and that value is being stored, making it tricky to query, since they don't contain a null value (i.e. where not null operating_system):

id short_url_id ip_address operating_system operating_system_version browser browser_version referer_url device_type visited_at created_at updated_at
13129 73372 xx.xx.xx.xx 0 0 0 0 desktop 2024-02-08 19:52:02 2024-02-08 19:52:02 2024-02-08 19:52:02

Since these are nullable columns, we should just omit these from being set and leave them null, so when running analytics, they can be excluded using where not null.

ash-jc-allen commented 4 months ago

This issue should now be solved in Short URL v8.0. If the user agent parser can't detect the data, the fields will be stored as null rather than false 😄

Release notes for v8.0: https://github.com/ash-jc-allen/short-url/releases/tag/v8.0.0