User Agent Populator

Last updated:

This app enhances incoming events by including browser & OS details from the $useragent property.

Note: This app is generally only needed when using clients that don't already set these properties, or when sending events directly from the server.

This app extracts the following properties from the provided $useragent:

PropertyDescriptionExample
$browserName of the browser for the userChrome, Firefox
$browser_versionThe version of the browser that was used70, 79
$osThe operating system of the userWindows, Mac OS X
$browser_typeThe type of client that made the requestbot, browser

Installation

PostHog Cloud

PostHog Cloud users can find the app here in their dashboard.

Before you can enable the app, you will need to configure it by clicking on the settings icon. Once the app has been configured, you can enable it by flipping the toggle and it will start transforming all new events.

PostHog Self-hosted

The User Agent Populator requires a PostHog instance running version 1.30.0 or later. Not running 1.30.0? Find out how to update!

  1. Visit the 'Apps' page in your instance of PostHog.
  2. Search for 'User Agent Populator'.
  3. Configure the app by clicking on the settings icon.
  4. Click the toggle to enable the app.

Once the app has been configured and enabled, it will begin to transform all new events which come into PostHog.

Configure

Before an app can be enabled in PostHog, it has to be configured.

OptionDescription
Can override existing browser related properties of event?
Type: string
Required: False
If the ingested event already have $browser $browser_version properties in combination with $useragent the $browser, $browser_version properties will be re-populated with the value of $useragent
Automatically read segment_userAgent property, automatically sent by Segment via analytics.js?
Type: choice
Required: False
Segment's analytics.js library automatically sends a useragent property that Posthog sees as segment_userAgent. Enabling this causes this plugin to parse that property

Using the User Agent Populator

This app works by parsing the $useragent property on events as they are ingested. As a result, if an event is ingested without the $useragent (or $user-agent) property set, this app will do nothing. This property can be set using any of our client or server libraries.

Note: Most of our client libraries will already automatically extract the $browser, $browser_version, and $os properties, so there is no need to set the $useragent property when using these libraries.

One common use-case for this app is populating client information when sending events from the server-side. Typically, a UserAgent header will be set when a client sends a request to your server, which your server can then forward to PostHog with the $useragent property. This gives you an idea of what types of clients are using your service and allows you to create insights that filter based on these properties.

What if my question isn't answered above?

We love answering questions. Ask us anything via our Questions page or using the Q&A widget at the bottom of this page.

You can also join the PostHog Community Slack group to collaborate with others and get advice on developing your own PostHog apps.

Further information

Who created this app?

This app was created by the community. We'd like to thank Weyert for creating the User Agent Populator, as well as for all the other support and feedback. Thank you, Weyert!

Who maintains this app?

This app is maintained by the community. If you have issues with the app not functioning as intended, please raise an issue on the repo.

What if I have feedback on this app?

We love feature requests and feedback! Please create an issue to tell us what you think.

Questions?

Was this page useful?

Next article

Pineapple Mode

What does the Pineapple Mode app do? Activating Pineapple Mode makes it rain pineapples all over your product or website. Yes, really. OK, but why does Pineapple Mode do that? Pineapple Mode is an example site app. Site apps are a new, big and currently beta feature which enable you to inject code from PostHog into your website via posthog-js . We think site apps are a potentially useful feature for things such as displaying forms, notifications or surveys in your product or website. They're…

Read next article