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 south, let anxiety run its course.

Homer covers his eyes

An alternative, less exciting, approach to life is to become aware as things change. For example, you can use PostHog's new alert features to receive notifications based on your insights.

You can track important metrics, and get email notifications if they cross 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%).

So, instead of having to remember to check in on the status of a a metric or feature; you can receive an email alert when changes occur.

Let's get started with how to create alerts, and then we can dive into some practical examples of how alerts can be helpful.

How to create alerts

Alerts are based on your insights. You can select from your existing trends, or create a new one.

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

alerts button

To configure a new alert, we'll set the following:

  • Name: this is the name you'll see when the alert fires.
  • When: select the data points the alert will be based on. The drop-down contains a list of all the series 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:
    • absolute value: check if the series is more than or less than a specified amount.
    • relative value: check if the series has increased or decreased by a specified amount. These can also be configured with a percentage instead of a static value (signups increased by 10%).
alert type picker

Then, we can configure the notification settings:

  • Frequency: how often we want to check the alert threshold (hourly, daily, weekly, monthly)
  • Who to notify: who should receive an email when the alert is triggered
filled alert

Lastly, you click Create alert, and you're all set.

insight alerts

If the alert threshold is met, you'll get an email that looks like this:

Alert email

For more detailed specifics when creating alerts, see our Alerts docs.

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 when traffic spikes for your website? This can be useful for testing marketing campaigns to see if they trigger the expected spikes in traffic.

But these kinds of alerts can also be useful to investigate an unexpected spike in traffic. We often see this at PostHog when our content gets featured in a popular email newsletter.

For example, we can get an alert when the number of pageviews for the pricing page rises above 8,000 views for the week.

  1. Create a new Trend insight.
  2. Set up a "Pageview" series and filter for where "Path Name" equals "/pricing". Year to date, group by week.
  3. Create an alert. Name "Pricing pageviews exceeded 8K" when pageview has value > 8000. Check weekly and notify.

2. Get notified for 404 page anomalies

Track the number of visits to your 404 page. If a user visits posthog.com/some-nonexistent-url then it will take them to the 404 page. Some number of visits to this page are expected.

But if the number of visits to this page suddenly spikes, it could mean there's an important broken link somewhere. Or perhaps you moved a page, and need to set up a redirect to prevent users from missing it.

Graph the number of 404s. Find spikes. Click the graph to view instances. View session replay recording. Great success.

I actually found a 404 in our first five article while writing this!

In addition to 404s, this same logic can be applied to other things like rageclick events. "A user has rapidly and repeatedly clicked in a single place" "Rageclicks are triggered only when a user clicks three or more times (maximum 1s between each click) without moving their mouse."

3. Alert if billing emails are not sent

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

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.

  1. Trigger events when you send transactional emails.
  2. Create a transactional_email event.
  3. Create an insight.
  4. Create your alert.

Alerts also have the ability to notify multiple team members. For critical insights like this one, you can configure the alert with the emails for everyone on your billing team instead of a single individual.

4. Monitor deploys and new features

"This would be useful as a simple canary to catch misconfigured deployments"

https://posthog.com/tutorials/canary-release

Shipped a new page with a new CTA, but no one is clicking it. You can set an if less than 100 people click the CTA over the next week.

Simpson you've got a 513

5. Conversion rates

When the conversion rate drops below a certain threshold

6. Alert on breakdown in referral sources

Alert on major changes in breakdowns. "For example, I have a graph showing traffic to my site by day broken down by referrer - if there's a major change in who's referring traffic (a bunch of new traffic from a new source, or a previous major source of traffic disappearing) I'd love to be able to get alerts about that, even if the overall traffic total doesn't shift.

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

Suggestions and upcoming improvements

Alerts are email-based, but PostHog also has features for sending your event data to Slack.

Alerts are currently available for trends insights. But they're also in the works for funnels, which will make tracking conversion rates easier. For example, we can create a funnel to see how many users are following through and signing up after visiting our pricing page.

Any other features you'd like to see? Or interesting use cases to share?

Comments