Events

Last updated:

The most important thing that PostHog does is to capture events from your website or application. An event is any action a user takes on your website or in your application - if they click a button or visits a page, that's an event.

Live events

Events table

To see your live events table, click 'Events' on the left sidebar. Here you will see a live feed of Events as they are happening.

Event properties

You can view the properties of each event by clicking on the items in the ‘Event’ column:

Events table

You can also click each user to view a their entire event history.

Default events and properties

You may notice that some events or properties are prefixed with $ e.g., $pageview, $feature_flag_called, $current_url, or $os_version. This indicates that these are default PostHog events or properties.

Pageview events

$pageview events are automatically sent when using the JavaScript snippet or SDK. You can disable this by setting capture_pageview: false in the initialization config.

You can manually send pageview events by calling posthog.capture('$pageview'). This is necessary for single-page applications like React, Next.js or Vue, since otherwise a pageview event is only sent for the first page.

Pageleave events

Similar to pageview, $pageleave events are automatically sent. You can disable them by setting capture_pageleave: false in the config. For single-page applications, you'll also need to manually send these events using posthog.capture('$pageleave').

Event filtering

You can filter events by properties and cohorts to focus on specific events that are occurring in your project.

While ingesting events in the plugin server PostHog detects some type information for properties to allow more intelligent filtering.

PostHog detects:

  • Boolean
  • Dates and Timestamps
  • Numbers
  • Strings
  • Everything else

If you feel something has been detected incorrectly, you can manually change the type by going to Data management -> Properties -> Choose event -> Edit, and then changing the property type manually.

Boolean (true or false)

PotHog detects boolean values and allows filtering by only:

  • equals
  • doesn't equal
  • is set
  • is not set

query list for a boolean property lists only equals, doesn't equal, is set, and is not set

Dates and Timestamps

PostHog detects several formats of string as dates and times

In detection day and month are interchangeable so MM-DD-YYYY would be detected as a date.

Ten and Thirteen digit numbers are detected as timestamps if the property name includes "time" or "timestamp"

Filtering against that property will then show a date picker and allows filtering only:

  • equals
  • before
  • after
  • is set
  • is not set

query list for a date time property lists only equals, before, after, is set, is not set

Numeric

PostHog detects numeric properties and allow filtering by only:

  • equals
  • doesn't equal
  • matches regex
  • doesn't match regex
  • greater than
  • lower than
  • is set
  • is not set

query list for a numeric property lists equals, doesn't equal, matches regex, doesn't match regex, greater than, lower than, is set, and is not set

Strings (text)

PostHog detects text content. If it is not true/false, numeric, or a date time. You can filter by:

  • equals
  • doesn't equal
  • contains
  • doesn't contain
  • matches regex
  • doesn't match regex
  • is set
  • is not set

query list for a string property lists equals, doesn't equal, contains, doesn't contain, matches regex, doesn't match regex, is set, and is not set

Everything else

If PostHog does not detect a type for an event property. You can choose any of the possible filters.

Autocapture event tracking

PostHog can capture all frontend events automatically. This means you do not need to manually add tracking to individual buttons or other parts of your product to start analyzing user behavior.

To get started, see our autocapture docs.

Push-based event tracking

Most users of PostHog will want to combine their back-end data, such as user information, with the front end actions of those users in their UI. There are three ways of passing data to PostHog:

Further reading

Want to know more about what's possible with Events in PostHog? Try these tutorials:

Want more? Check our full list of PostHog tutorials.

Questions?

Was this page useful?

Next article

Identifying users

How identify works Best practices when using identify 1. Call identify as soon as you're able to 2. Use unique strings for distinct IDs 3. Reset after logout 4. Setting user properties Alias: Assigning multiple distinct IDs to the same user Sometimes, you want to assign multiple distinct IDs to a single user. For example, if a distinct ID which is typically used on the frontend is not available in certain parts of your backend code, you can use alias to connect the frontend distinct ID to…

Read next article