6 practical uses for PostHog alerts

Dec 16, 2024

To keep life interesting, it's important to live in a state of perpetual ignorance. When things are going well, there's no need to find out why. When things go downhill, let anxiety run its course.

Homer covers his eyes

An alternative, less exciting, approach to life is to be aware of change. A great first step in this approach is using PostHog's new alert features to receive notifications based on your data and insights.

Instead of needing to manually check insights, you can track important metrics and get email notifications when they cross a threshold that you specify. The threshold can be an absolute value (e.g. pageviews exceeded 1,000) or a relative amount (e.g. conversion rate increased by 10%).

To show you how you can use alerts, we'll start by showing how to create an alert and then dive into practical examples and use cases.

How to create alerts

Alerts are based on your insights. You can set them on your existing trends or after creating a new one.

To create an alert, click the Alerts button on the top right of the insight page.

alerts button

To configure the alert, set the following:

  • Name: the name you'll see when the alert is triggered.
  • When: the data points the alert will be based on. The drop-down contains a list of all the series in your insight's graph. For example, if you have an insight that tracks the number of pageviews and signups, you can use either of these series as the basis for the alert threshold.
  • Type: select "has value" to check if the series is more or less than an absolute amount. Or, select "increases by/decreases by" to check if the series increased or decreased by a relative amount. These can also be configured with a percentage instead of a static value (e.g. signups increased by 10%).
  • Frequency: set how often you want to check the alert threshold (hourly, daily, weekly, monthly).
  • Who to notify: select who should receive an email when the alert is triggered.
filled alert

Then, click Create alert and you'll see the new alert:

insight alerts

For a more detailed walkthrough, you can also check out our Alerts docs, which we'll update as we add new features.

Practical uses for alerts

Now that we can create alerts, let's take a look at a handful of practical examples.

1. Get an alert when traffic spikes

Want to investigate spikes in traffic to your website? Monitoring the traffic to your website can help you measure the success of marketing campaigns and understand which activities drive the most visitors to your site.

These kinds of alerts can also be useful when traffic spikes are unexpected. We often see this at PostHog when our content gets featured in a popular email newsletter or shared on Hacker News. When we notice an influx of new signups, it can be fun to dig in and try to figure out where they came from.

For example, we can set up an alert when the number of pageviews for our pricing page rises above 8,000 views for the week. First, we create a new trend insight to track pageviews where "Path Name" equals "/pricing". Then, filter by the year-to-date and group by week.

Then, set up an alert using the steps above to trigger a notification when the number of pageviews rises above 8,000. When the threshold is crossed, this is what the email alert looks like:

Pricing pageviews alert

2. Get notified for 404 page anomalies

You can also use alerts to track down errors. For example, you can track the number of visits to your 404 page. If someone visits posthog.com/some-nonexistent-url, they will land on our 404 page. Some number of these kinds of visits to this page is to be expected. Anyone that misspells a URL or finds a dead link is bound to land here at some point.

But what about anomalous spikes in 404s? It might mean you deployed a broken link somewhere. Or perhaps you moved a page and need to set up a redirect to prevent users from missing it.

In this case, you can set up another trend insight to graph the number of pageviews for your 404 page. You can examine the graph to establish a baseline for a standard amount of traffic to the 404 page. Then, set up an alert to check when 404s are significantly higher than this baseline.

404 graph

You can also click the graph where you see a spike and it will display a list of all the users effected. If you have session replay enabled, you can watch the session where the 404 occurred and figure out exactly which link is broken.

In addition to 404s, this same logic can be applied to other events like "rageclicks." Rageclick events are when a user has rapidly and repeatedly clicked in a single place. It could be an indicator that there is some visual affordance that looks like it should be interactive, but users are surprised to find out it does nothing. You can use the same process we used for the 404 visits to hunt down rageclicks as well.

3. Alert if billing emails are not sent

Alerts can also be used to check for the absence of something happening.

For example, PostHog tracks the number of transactional billing emails that get sent out every day. If these emails aren't getting sent, it would be a big deal.

To do something similar, you can track events when you trigger transactional emails. Then, create an insight to track the number of emails sent every day.

Then, we can set up an alert called "No billing events sent" that gets triggered when the transactional emails have a value less than 1. In other words, it will trigger the alert if no emails get sent.

We can set the frequency to check this daily. For critical alerts like this, you can add more than one email to the notification list and ensure the entire billing team receives the alert.

4. Monitor deploys and new features

With feature flags, you can set up canary releases to safely roll out changes and make sure your new features work well before they're released to all your users.

But you still want to monitor deploys and new features to verify that they're having the intended effect and not triggering unexpected errors.

Simpson, you've got a 513 That got it

For example, you could track error events and trigger an alert if the error rate rises above a particular threshold after a new feature launch.

But there are more subtle issues that aren't necessarily bugs or errors. For example, you could launch a big redesign for the product pages on your marketing website. Or change the copy on some of your CTAs. Those won't necessarily trigger errors, but they could still have a drastic impact on engagement.

So you can set up an alert that coincides with the launch of a redesigned page and verify that the number of CTA clicks should hopefully be increasing, not decreasing.

5. Alert on changes in conversion rates

To set alerts on changes in your conversion rate, you can set up an insight that tracks visits to your pricing page and signups. For example, we can create a trend insight and filter for pageviews where "Path Name" equals "/pricing". And then add a filter for our user_signed_up event. So this insight will display a graph with a line for the number of pageviews for the pricing page as well as a separate line for the number of users that signed up.

Conversions

If we want to find out when the conversion rate increases or decreases by 10%, we can set up multiple alerts. We can set up one alert for when the user_sign_up event is increasing by 10% and a separate alert for when the user_sign_up event is decreasing by 10%.

Multiple alerts

6. Alert on breakdown in referral sources

We also have the ability to trigger alerts on trends with breakdowns. For example, you can track all the traffic to your website broken down by the referral source (e.g. google, substack, direct).

If there's a major change in where the traffic is coming from, we want to trigger an alert. Traffic could surge from a new source, or an existing source of traffic could disappear, even if the overall traffic remains the same.

Here's an example where we set up an alert when any of those breakdown values increases by 10% or more:

Breakdown alerts

📝 Note: For trends with a breakdown, the alert will fire if any of the breakdown values breaches the threshold.

Upcoming improvements and suggestions

Alerts are currently available for trends insights. But we're currently working on adding alerts for funnels, which will make it easier to track conversions across various stages. For example, we can create a funnel to see how many users are following through and signing up after visiting our pricing page.

Thanks to Anirudh for making this much-requested feature a reality. The idea for threshold-based alerts started as a GitHub issue, so if you have other interesting use cases and suggestions for how to improve the features, be sure to let us know!

Comments