• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
valdottown

valdottown

rage-clicks

Forward PostHog rage clicks to Discord
Public
Like
rage-clicks
Home
Code
3
README.md
H
main.ts
shell.ts
Branches
1
Pull requests
Remixes
History
Environment variables
1
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
Viewing readonly version of main branch: v14
View latest version
README.md

Rage Clicks Webhook → Discord

Receive PostHog rage click events and forward them to Discord with human-readable alerts.

What are Rage Clicks?

Rage clicks occur when a user repeatedly clicks on something that doesn't respond as expected. They're a strong signal of user frustration and often indicate:

  • Broken buttons or links
  • Slow-loading UI
  • Confusing interface elements
  • Missing click handlers

Setup

1. Set up Discord Webhook

  1. In your Discord server, go to Server Settings → Integrations → Webhooks
  2. Click New Webhook and copy the webhook URL
  3. Add it to this val's environment variables as DISCORD_WEBHOOK_URL

2. Configure PostHog Webhook

  1. In PostHog, go to Data Pipelines → Destinations → Create Destination
  2. Select Webhook as the destination type
  3. Enter this val's endpoint URL: https://valdottown--rage-clicks.web.val.run
  4. Set up a filter for the $rageclick event

How it Works

When PostHog detects a rage click, it sends a webhook to this val containing:

  • The element that was clicked (as a complex elements_chain string)
  • The page URL
  • User/session information
  • Browser/device details
  • Geo location

This val:

  1. Parses the elements_chain into a human-readable description (e.g., "Save Changes" button instead of raw CSS selectors)
  2. Formats a Discord embed with all relevant context
  3. Sends an alert to your Discord channel

Example Discord Alert

The alert includes:

  • 🖱️ Clicked Element: What the user was clicking on
  • 📍 Page: The URL where it happened
  • 🌍 Location: User's geographic location
  • 💻 Device: Browser and OS info
  • 📱 Screen: Viewport dimensions
  • 👤 User ID: Identified or anonymous user
  • 🚪 Session Entry: Where the user started (if different)

Testing

Run shell.ts to send a test rage click event to Discord. It includes several sample scenarios you can uncomment:

// Choose which sample to send: const eventToSend = sampleRageClickEvent; // Button click // const eventToSend = sampleInputRageClick; // Input field // const eventToSend = sampleIconRageClick; // Icon/SVG

Types

The val exports TypeScript types you can use:

import type { PostHogRageClickEvent } from "https://esm.town/v/valdottown/rage-clicks/main.ts"; import { parseElementsChain } from "https://esm.town/v/valdottown/rage-clicks/main.ts"; // Parse any PostHog elements_chain const element = parseElementsChain(chain); console.log(element.description); // '"Save Changes" button'

Files

  • main.ts - HTTP handler that receives webhooks and sends Discord alerts
  • shell.ts - Test script with sample rage click events
  • README.md - This file
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.