Browser: A browser detection in Go
Tags: go, programming, webdev, opensource
Published: 2023-10-16 08:25:14

[https://github.com/dineshgowda24/browser](https://github.com/dineshgowda24/browser)

**What does it do?**

The browser Go Package is designed to parse user agent strings, providing valuable insights into the user’s browser, device, and operating platform. This Package simplifies the often intricate process of user agent analysis and proves particularly beneficial for web applications that require customized responses based on the client’s characteristics.

**Why was it created?**

This project was born out of practical need. We encountered situations where it was essential to identify the client’s browser, device, and platform.

One significant application was the creation of an in-house URL shortener, complete with deep linking and universal linking capabilities. These shortened URLs were used for marketing campaigns across various social media platforms and for sending notifications through different channels like WhatsApp. The uniqueness of this URL shortener lies in its ability to adapt to multiple clients

- **Enhanced Link Engagement:** Unlike typical URL shorteners that redirect to the target URL when opened in a browser, this service ensures that shared links on social media platforms appear more engaging. It achieves this by returning plain HTML with Open Graph (OG) tags, making the URL’s content rich and enticing to click on, especially when the client is not an actual browser, i.e. for bots/link expanding requests from social media sites. This approach significantly improves Click-Through Rates (CTR).
- **Platform-Based Redirection:** Besides mere redirection, this project allows for platform-specific redirection to app stores, making it ideal for app-only links. This is a feature not commonly found in generic URL 
- **Search Engine Optimization (SEO):** To optimize SEO, rendering content differently for Google bots is often necessary. This project facilitates that, ensuring the backend API responds appropriately when Google bots access the site.
- **Analytics:** The Package also serves as a valuable tool for analytics related to short links. It enables tracking client information, including the browser, device, and platform, for informed product decisions and other strategic considerations.

**Why it’s useful, especially compared to similar existing projects?**

This Package stands out for several reasons:

- **Robust Data Backing:** The Package is supported by a comprehensive database of user agents bought from https://www.whatismybrowser.com/. With access to a database containing 250 million user agents, testing clients across various devices and platforms is straightforward and 
- **Extensive Client Support:** The project offers support for a comprehensive list of browsers, devices, platforms, and bots, making it versatile and accommodating of diverse client - **Code Extensibility:** It’s easy to extend the Package to support new clients with minimal code changes, ensuring that adding new features doesn’t disrupt existing 
- **Thorough Testing:** The project includes a substantial number of unit tests, assuring the reliability and stability of its functionality.