Internet Promoted

Tailor Your Website Perfectly With Userstack’s User-Agent API

Christian Cawley 28-01-2019

Are visitors getting the most from your website? Do you cater to readers on portable devices, handsets with very small screens, or even TVs?

If not, it’s time you did. Userstack is an API from London-based apilayer that accurately detects the browser and hardware details of your website’s visitors. Here’s what you need to know about userstack and how it can make your website better.

What Can userstack Do for You?

Using the userstack API, you can detect the browser, device details, and operating system of any visitor to your website.

The benefits of this are considerable. For example, you can ensure your visitors receive tailored advertising. Want to publish custom content for readers using a specific type of device (such as an iPhone)? With data from userstack, you can.

This information is gathered thanks to User-Agent strings, information sent from your browser to the destination website.

Essentially, userstack offers an opportunity to perfect the user experience. Visitors will remember this and return, recalling an impressive, tailored experience.

How Much Does userstack Cost?

A free userstack account is available, along with several premium options.

Userstack pricing guide

If don’t need more than 10,000 API requests per month, the free option is perfectly suitable. With this, you’ll get device, browser, and operating system detection, plus limited support. It’s a basic package ideal for smaller sites and newcomers.

Not enough? Four other packages are available, from Basic to Enterprise (with business-specific pricing). The Business package of 500,000 API lookups for $49.99 a month provides the best value. This adds unlimited support, crawler detection, bulk lookups, and HTTPS encryption.

Need more lookups? The Business pro option provides a preferred support option, along with 2 million monthly lookups, for $99.99 a month.

Whatever package you choose, note that there is a 20 percent discount for annual payment.

Key userstack Features

Signing up to userstack gives you the opportunity to improve your readers’ (or customers’) experience. The most obvious use for a service like this is to query the User-Agent and deliver content in a format that’s most suitable for the visitor.

To deliver this feature, userstack has a scalable server that’s capable of handling up to several million API requests every day. Along with this, userstack offers accurate system data and seamless integration via the JSON REST API interface.

Other uses include delivering a platform-specific link to the appropriate mobile app. Need some extra security for your site? Subscriptions also include spambot detection and crawler prevention services.

Getting Started With userstack

You can sign up for a free account at See the window on the right side of the home page? This demonstrates the API in action.

Userstack User-Agent example

Take a moment to look at this, and you’ll see that it’s displaying the User-Agent information from your own browser!

Here you’ll find information pertaining to the browser and operating system, OS vendor, type of computer, and browser version and engine.

Sign up to gain access to the Account Dashboard. Here you’ll find the API Access key (for running userstack on your site), along with details about your chosen plan.

The userstack Quick Start

To ease you in, userstack has made everything straightforward.

In addition to the API key (which you should keep safe, but can reset if required via the account dashboard), userstack provides two API endpoints:

  • Single Lookup: use HTTP GET to look up any User-Agent string
  • Bulk Lookup: use HTTP POST to look up multiple strings

A Base URL is also provided. With this, you can make a simple API request:

? access_key = YOUR_API_ACCESS_KEY

& ua = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36

Check the userstack site for other API requests you can use, each with their own specific results.

Using userstack on Your Website

If you’re new to using APIs and interrogating the User-Agent information, you’re probably not too sure about how userstack can benefit you.

Sample JavaScript code for userstack

In its simplest terms, the code can be embedded in your HTML, or in a separate JavaScript file.

Get started by wrapping the code in JavaScript <script> tags in your HTML. At this stage, either include the commands inline, or link to a dedicated JavaScript file elsewhere on the server.

The results of the User-Agent string can help you to target content to a particular subsection of users. You can also ensure that people using older browsers and hardware can still read your site, by providing pages for them with more basic stylesheets.

Not using JavaScript on your site? Don’t worry: you can implement userstack’s API in other languages. PHP, Python, Nodejs, JQuery, Go, and Ruby examples are all are provided on the site for your convenience.

Userstack: The Secure User-Agent String Lookup You Need

Admittedly a service like userstack isn’t for every website. You might not need advanced APIs, and be happy with the information you can glean from Google Analytics.

But to make the most of User-Agent information, userstack is ideal, and it’s free to get started.

Interested in signing up for userstack and employing it on your site? Some JavaScript expertise is useful, but if you’re new to scripting, our guide to JavaScript and how it works What Is JavaScript and How Does It Work? If you're learning web development, here's what you need to know about JavaScript and how it works with HTML and CSS. Read More should help.

Related topics: IP Address, Web Analytics, Webmaster Tools.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *