Public
Like
rage-clicks
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.
Viewing readonly version of main branch: v17View latest version
Receive PostHog rage click events and forward them to Discord with human-readable alerts.
- In your Discord server, go to Server Settings → Integrations → Webhooks
- Click New Webhook and copy the webhook URL
- Add it to this val's environment variables as
DISCORD_WEBHOOK_URL
- In PostHog, go to Data Pipelines → Destinations → Create Destination
- Select Webhook as the destination type
- Enter this val's endpoint URL:
https://valdottown--rage-clicks.web.val.run - Set up a filter for the
$rageclickevent
When PostHog detects a rage click, it sends a webhook to this val containing:
- The element that was clicked (as a complex
elements_chainstring) - The page URL
- User/session information
- Browser/device details
- Geo location
This val:
- Parses the
elements_chaininto a human-readable description (e.g.,"Save Changes" buttoninstead of raw CSS selectors) - Formats a Discord embed with all relevant context
- Sends an alert to your Discord channel
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)
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
- main.ts - HTTP handler that receives webhooks and sends Discord alerts
- shell.ts - Test script with sample rage click events
- README.md - This file