User Agent Parser avatar

User Agent Parser

Pricing

Pay per event

Go to Apify Store
User Agent Parser

User Agent Parser

This actor parses user agent strings to extract browser name/version, operating system, device type, rendering engine, and bot detection. Useful for analytics, traffic analysis, and bot detection.

Pricing

Pay per event

Rating

0.0

(0)

Developer

Stas Persiianenko

Stas Persiianenko

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

9 days ago

Last modified

Categories

Share

Parse user agent strings into browser, OS, device, and engine details.

What does User Agent Parser do?

This actor parses user agent strings to extract browser name and version, operating system details, device type, rendering engine, and bot detection flags. It processes multiple user agent strings in a single run and returns structured data for each one. Useful for web analytics, traffic analysis, bot detection, and audience segmentation.

Use cases

  • Web analyst segmenting website traffic by browser, OS, and device type to optimize user experience
  • Security engineer detecting bot traffic and crawlers by analyzing user agent strings from access logs
  • QA engineer verifying that a web application sends the correct user agent for different test environments
  • Product manager understanding the device and browser breakdown of users to prioritize platform support
  • Data engineer enriching raw log data with structured browser and OS fields for analytics pipelines

Why use User Agent Parser?

  • Comprehensive parsing -- extracts browser, browser version, engine, engine version, OS, OS version, device name, and device type from each string
  • Bot detection -- flags known bots and crawlers with the isBot field so you can filter them from real user traffic
  • Device classification -- categorizes each user agent as desktop, mobile, or tablet with dedicated boolean flags
  • Batch processing -- parse hundreds of user agent strings in a single run instead of processing them individually
  • Structured JSON output -- clean, consistent results ready for analytics dashboards, databases, or downstream processing
  • Pay-per-event pricing -- only $0.0005 per user agent parsed, plus a one-time start fee

Input parameters

ParameterTypeRequiredDefaultDescription
userAgentsstring[]Yes--List of user agent strings to parse
{
"userAgents": [
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120.0.0.0 Safari/537.36",
"Googlebot/2.1 (+http://www.google.com/bot.html)"
]
}

Output example

Each user agent string produces a result object with the following fields:

FieldTypeDescription
userAgentstringThe original user agent string
browserstringBrowser name (e.g., Chrome, Firefox, Safari)
browserVersionstringBrowser version number
enginestringRendering engine (e.g., WebKit, Gecko, Blink)
engineVersionstringEngine version number
osstringOperating system name (e.g., Windows, macOS, Linux, iOS, Android)
osVersionstringOS version number
devicestringDevice name (if identifiable, otherwise null)
deviceTypestringDevice category: desktop, mobile, or tablet
isBotbooleanWhether the user agent belongs to a known bot or crawler
isMobilebooleanWhether the device is a mobile phone
isDesktopbooleanWhether the device is a desktop or laptop computer
{
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) ...",
"browser": "Chrome",
"browserVersion": "120.0.0.0",
"engine": "WebKit",
"engineVersion": "537.36",
"os": "Windows",
"osVersion": "10.0",
"device": null,
"deviceType": "desktop",
"isBot": false,
"isMobile": false,
"isDesktop": true
}

How much does it cost?

EventPriceDescription
Start$0.035One-time per run
UA parsed$0.0005Per user agent parsed

Example costs:

  • 10 user agents = $0.035 + (10 x $0.0005) = $0.04
  • 100 user agents = $0.035 + (100 x $0.0005) = $0.085
  • 1,000 user agents = $0.035 + (1,000 x $0.0005) = $0.535

Using the Apify API

You can start User Agent Parser programmatically from your own applications using the Apify API. Below are examples in Node.js and Python.

Node.js

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_TOKEN' });
const run = await client.actor('automation-lab/user-agent-parser').call({
userAgents: [
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120.0.0.0 Safari/537.36',
'Googlebot/2.1 (+http://www.google.com/bot.html)',
],
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);

Python

from apify_client import ApifyClient
client = ApifyClient('YOUR_TOKEN')
run = client.actor('automation-lab/user-agent-parser').call(run_input={
'userAgents': [
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/120.0.0.0 Safari/537.36',
'Googlebot/2.1 (+http://www.google.com/bot.html)',
],
})
items = client.dataset(run['defaultDatasetId']).list_items().items
print(items)

Integrations

User Agent Parser works with the full Apify integration ecosystem. You can connect it to a wide range of automation platforms and data destinations:

  • Make (formerly Integromat) -- trigger user agent parsing as a step in an analytics automation scenario
  • Zapier -- parse user agents automatically as part of your zap workflows
  • n8n -- use the Apify node in n8n workflows for self-hosted log processing pipelines
  • Slack -- send parsed results or bot detection alerts to a Slack channel
  • Google Sheets -- export browser and device breakdowns to a spreadsheet for reporting
  • Amazon S3 -- store parsed datasets in S3 buckets for analytics data lake ingestion
  • Webhooks -- send results to any HTTP endpoint for real-time traffic analysis

You can also schedule recurring runs on the Apify platform to process new log data on a timer.

Tips and best practices

  • Export access logs first -- extract user agent strings from your web server logs (Apache, Nginx, or CDN logs) and pass them as the input array for bulk analysis.
  • Filter bots early -- use the isBot field to separate crawler traffic from real users before running analytics on the parsed data.
  • Group by deviceType -- aggregate results by desktop, mobile, and tablet to understand your audience's device distribution.
  • Track browser versions -- monitor which browser versions your users run to decide when to drop support for older versions.
  • Combine with web scrapers -- capture user agent strings from scraped data or API responses and parse them to enrich your datasets.

FAQ

How accurate is the bot detection? The actor detects well-known bots and crawlers (Googlebot, Bingbot, etc.) based on patterns in the user agent string. Custom or obscure bots that mimic real browser user agents may not be detected. For advanced bot detection, combine this data with behavioral analysis.

What does deviceType return for tablets? Tablets are classified as tablet with isMobile: false and isDesktop: false. Phones are classified as mobile. Desktop browsers (including laptops) are classified as desktop.

Can I parse user agents from mobile apps? Yes. The actor handles any valid user agent string, including those from mobile apps, WebView containers, and embedded browsers. The parsed fields will reflect whatever information the app includes in its user agent string.

What happens with empty or malformed user agent strings? Empty strings or strings that do not match any known user agent pattern will still produce a result object. The browser, OS, and device fields will be null or empty, and deviceType will default to desktop. The isBot flag will be false unless the string matches a known bot pattern.