Events

Last updated:

|Edit this page

An event is the core unit of data in PostHog. It represents an interaction a user has with your app or website. Examples include button clicks, pageviews, query completions, and signups.

Events consist of:

  1. An event name like $pageview or query completed. Events starting with $ are PostHog defaults.

  2. A distinct_id which is a unique identifier for person, commonly a uuidv7 value like 018daf23-89b3-7cf8-a4f1-94064c96df90

  3. A timestamp in ISO 8601 format, which is the time the event occurred like 2024-05-22T17:09:29.220Z. This is most commonly now(), but can also be in the past.

  4. properties, which are additional data like color or $current_url. Properties starting with $ are PostHog defaults.

You can capture custom events using any of our SDKs or our API. PostHog's client-side SDKs, like JavaScript Web and React Native, can also autocapture events for you.

You can view recent events in your activity tab, which automatically updates every 30 seconds for a live view of activity in your app.

How events power PostHog

PostHog is event-based, meaning much of the functionality is triggered through events. Much of this is handled (and made nicer) by our SDKs, but under the hood, it is largely events. For example:

  • Changing person properties using $set and $unset properties.

  • Identifying an anonymous user with the $identify event.

  • Connecting two users with the $create_alias event.

  • Creating and updating groups using $groupidentify events and $group properties.

  • Calculating bounce rate for web analytics relies on the $pageleave event.

  • Calculating exposure and statistical significance for experimentation with the $feature/experiment-feature-flag-key property and $feature_flag_called event.

  • Sending data to webhooks is triggered by ingesting specific events.

Anonymous vs identified events

PostHog captures two types of events: anonymous and identified. Identified events enable you to attribute events to person profiles, while anonymous events do not.

See our docs on anonymous vs identified events for more information.

Event properties

Like persons and sessions, events have properties. These are used for filtering, breakdowns, cohorts, targeting, and more.

While ingesting events, PostHog detects some type information for properties such as:

  • Strings AKA text (default)
  • Boolean
  • Dates and timestamps
  • Numbers
  • Arrays
  • Objects

If something has been detected incorrectly, you can manually change the type by going to properties tab in data management, selecting the property, clicking on Edit, and then changing the property type manually. You can also add tags or mark a property as verified on this page.

Edit properties

Default properties

Below is a list of some of the properties that PostHog captures by default in client-side apps. You can see the full list of properties that PostHog captures by default in GitHub.

NameKeyExample value
Timestamp$timestamp2024-05-29T17:32:07.202Z
OS$osMac OS X
OS Version$os_version10.15.7
Browser$browserChrome
Browser Version$browser_version125
Device Type$device_typeDesktop
Current URL$current_urlhttps://example.com/page
Host$hostexample.com
Path Name$pathname/page
Screen Height$screen_height1080
Screen Width$screen_width1920
Viewport Height$viewport_height950
Viewport Width$viewport_width1903
Library$libweb
Library Version$lib_version1.31.0
Search Engine$search_enginegoogle
Referrer URL$referrerhttps://google.com
Referring Domain$referring_domainwww.google.com
Active Feature Flags$active_feature_flags['beta_feature']
Event Type$event_typeclick
UTM Source$utm_sourcenewsletter
UTM Medium$utm_mediumemail
UTM Campaign$utm_campaignproduct_launch
UTM Term$utm_termnew+product
UTM Content$utm_contentlogolink
Google Click ID$gclidTeSter-123
Google Ads Source$gad_sourcegoogle_ads
Google Search Ads 360 Click$gclsrcdsa
Google DoubleClick Click ID$dclidtestDclid123
Google Web-to-app Measure$wbraidtestWbraid123
Google App-to-web Measure$gbraidtestGbraid123
Facebook Click ID$fbclidtestFbclid123
Microsoft Click ID$msclkidtestMsclkid123
Twitter Click ID$twclidtestTwclid123
LinkedIn Ad Tracking ID$la_fat_idtestLaFatId123
Mailchimp Campaign ID$mc_cidtestMcCid123
Instagram Share Id$igshidtestIgshid123
TikTok Click ID$ttclidtestTtclid123
Plugins Succeeded$plugins_succeeded['GeoIP (56578)']
Plugins Failed$plugins_failed['plugin3']
Plugins Deferred$plugins_deferred['plugin4']
IP Address$ip192.168.1.1

Questions?

Was this page useful?

Next article

Anonymous vs identified events

How to capture anonymous events How to capture identified events Frequently asked questions What can and can't I do with anonymous events? You can : Set event properties Aggregate and filter events by event properties e.g. URL, geographic location, UTM source. Create insights like trends , funnels , SQL insights and more. You cannot : Set person properties Create cohorts Filter on person properties Use person properties for targeting feature flags, A/B tests, or surveys Query the…

Read next article