A precise and fast Ruby user agent parser and device detector backed by a large, up-to-date database.
DeviceDetector is a Ruby gem that parses HTTP user agent strings to detect detailed client information such as browser, operating system, device type, brand, and model. It solves the problem of accurately identifying client characteristics from web requests, which is essential for analytics, content adaptation, and security.
Ruby developers building web applications, analytics platforms, or middleware that require client detection from HTTP requests, such as podcast hosting services, ad tech, or access logging systems.
Developers choose DeviceDetector for its combination of speed, accuracy, and extensive database, offering better performance than alternatives like the 'browser' or 'user_agent' gems while staying current with device and browser trends through upstream updates.
DeviceDetector is a precise and fast user agent parser and device detector written in Ruby
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Leverages regex files from the Universal Device Detection library, covering thousands of user agents including rare browsers and devices, as listed in the README's bot and client sections.
Benchmarks in the README show DeviceDetector parses user agents 3-4 times faster than alternatives like Browser and UserAgent gems, making it ideal for high-throughput applications.
Improves accuracy by utilizing Sec-CH-UA and http-x-requested-with headers, demonstrated in usage examples for detecting browsers like Brave and Firefox Focus.
Offers in-memory caching with a default of 5,000 entries, tunable via configuration to balance speed and memory usage, as explained in the setup section.
As a port, it relies on regex files from the Matomo project, which could lead to compatibility issues or delays in incorporating new devices, as noted in the disclaimer.
The default cache size of 5,000 entries can use significant RAM, and improper tuning might affect performance in resource-constrained setups, requiring manual configuration.
Only available for Ruby, making it unsuitable for projects using other programming languages or requiring cross-platform solutions without Ruby integration.