User Agent Populator

Last updated:

|Edit this page

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

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

This transformation 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

Requirements

Using this requires either PostHog Cloud with the data pipeline add-on, or a self-hosted PostHog instance running version 1.30.0 or later.

Self-hosting and not running 1.30.0? Find out how to update your self-hosted PostHog deployment.

Installation

  1. In PostHog, click the "Data pipeline" tab in the left sidebar.
  2. Search for 'User Agent Populator'.
  3. Configure the transformation by clicking on the settings icon.
  4. Click the toggle to enable the transformation.

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

Configuration

Before an transformation 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 transformation 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 transformation 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 transformation 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 in our community forums or using the Q&A widget at the bottom of this page.

FAQ

Who maintains this?

This is maintained by the community. If you have issues with it not functioning as intended, please let us know!

What if I have feedback on this destination?

We love feature requests and feedback. Please tell us what you think..

What if my question isn't answered above?

We love answering questions. Ask us anything via our community forum.

Questions?

Was this page useful?

Next article

Troubleshooting and FAQs

My transformation or destination isn't working, what do I do? Checking that the transformation or destination is enabled with the correct configuration options in the data pipeline tab . You can find the correct configuration options in the transformation or destination's documentation by searching for it in the destinations, transformations, or filtering sections of the docs. Click "Logs & metrics" and go to the Metrics tab to check that the transformation or destination is processing…

Read next article