π Open source, privacy-first web analytics β a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
Alerts & Notification channels documentation
Blue Mouse1b83dda001fb
diff --git a/docs/components/channel-icons.tsx b/docs/components/channel-icons.tsxnew file mode 100644index 000000000..0584d8d5a--- /dev/null+++ b/docs/components/channel-icons.tsx@@ -0,0 +1,79 @@+import { BellRingingIcon, EnvelopeSimpleIcon, GlobeIcon } from "@phosphor-icons/react/dist/ssr";++interface IconProps {+ className?: string;+}++const DEFAULT_CLASSNAME = "inline-block size-4 align-[-0.125em] shrink-0";++export const EmailChannelIcon = ({ className }: IconProps) => (+ <EnvelopeSimpleIcon+ className={`${className ?? DEFAULT_CLASSNAME} text-slate-500 dark:text-slate-400`}+ weight="duotone"+ aria-hidden+ />+);++export const TelegramChannelIcon = ({ className }: IconProps) => (+ <svg className={className ?? DEFAULT_CLASSNAME} viewBox="0 0 1000 1000" aria-hidden>+ <defs>+ <linearGradient x1="50%" y1="0%" x2="50%" y2="99.2583404%" id="telegramGradient">+ <stop stopColor="#2AABEE" offset="0%" />+ <stop stopColor="#229ED9" offset="100%" />+ </linearGradient>+ </defs>+ <g stroke="none" strokeWidth={1} fill="none" fillRule="evenodd">+ <circle fill="url(#telegramGradient)" cx="500" cy="500" r="500" />+ <path+ d="M226.328419,494.722069 C372.088573,431.216685 469.284839,389.350049 517.917216,369.122161 C656.772535,311.36743 685.625481,301.334815 704.431427,301.003532 C708.567621,300.93067 717.815839,301.955743 723.806446,306.816707 C728.864797,310.92121 730.256552,316.46581 730.922551,320.357329 C731.588551,324.248848 732.417879,333.113828 731.758626,340.040666 C724.234007,419.102486 691.675104,610.964674 675.110982,699.515267 C668.10208,736.984342 654.301336,749.547532 640.940618,750.777006 C611.904684,753.448938 589.856115,731.588035 561.733393,713.153237 C517.726886,684.306416 492.866009,666.349181 450.150074,638.200013 C400.78442,605.66878 432.786119,587.789048 460.919462,558.568563 C468.282091,550.921423 596.21508,434.556479 598.691227,424.000355 C599.00091,422.680135 599.288312,417.758981 596.36474,415.160431 C593.441168,412.561881 589.126229,413.450484 586.012448,414.157198 C581.598758,415.158943 511.297793,461.625274 375.109553,553.556189 C355.154858,567.258623 337.080515,573.934908 320.886524,573.585046 C303.033948,573.199351 268.692754,563.490928 243.163606,555.192408 C211.851067,545.013936 186.964484,539.632504 189.131547,522.346309 C190.260287,513.342589 202.659244,504.134509 226.328419,494.722069 Z"+ fill="#FFFFFF"+ />+ </g>+ </svg>+);++export const DiscordChannelIcon = ({ className }: IconProps) => (+ <svg className={className ?? DEFAULT_CLASSNAME} viewBox="0 0 127.14 96.36" aria-hidden>+ <path+ fill="#5865f2"+ d="M107.7,8.07A105.15,105.15,0,0,0,81.47,0a72.06,72.06,0,0,0-3.36,6.83A97.68,97.68,0,0,0,49,6.83,72.37,72.37,0,0,0,45.64,0,105.89,105.89,0,0,0,19.39,8.09C2.79,32.65-1.71,56.6.54,80.21h0A105.73,105.73,0,0,0,32.71,96.36,77.7,77.7,0,0,0,39.6,85.25a68.42,68.42,0,0,1-10.85-5.18c.91-.66,1.8-1.34,2.66-2a75.57,75.57,0,0,0,64.32,0c.87.71,1.76,1.39,2.66,2a68.68,68.68,0,0,1-10.87,5.19,77,77,0,0,0,6.89,11.1A105.25,105.25,0,0,0,126.6,80.22h0C129.24,52.84,122.09,29.11,107.7,8.07ZM42.45,65.69C36.18,65.69,31,60,31,53s5-12.74,11.43-12.74S54,46,53.89,53,48.84,65.69,42.45,65.69Zm42.24,0C78.41,65.69,73.25,60,73.25,53s5-12.74,11.44-12.74S96.23,46,96.12,53,91.08,65.69,84.69,65.69Z"+ />+ </svg>+);++export const SlackChannelIcon = ({ className }: IconProps) => (+ <svg className={className ?? DEFAULT_CLASSNAME} viewBox="0 0 127 127" aria-hidden>+ <path+ d="M27.2 80c0 7.3-5.9 13.2-13.2 13.2C6.7 93.2.8 87.3.8 80c0-7.3 5.9-13.2 13.2-13.2h13.2V80zm6.6 0c0-7.3 5.9-13.2 13.2-13.2 7.3 0 13.2 5.9 13.2 13.2v33c0 7.3-5.9 13.2-13.2 13.2-7.3 0-13.2-5.9-13.2-13.2V80z"+ fill="#E01E5A"+ />+ <path+ d="M47 27c-7.3 0-13.2-5.9-13.2-13.2C33.8 6.5 39.7.6 47 .6c7.3 0 13.2 5.9 13.2 13.2V27H47zm0 6.7c7.3 0 13.2 5.9 13.2 13.2 0 7.3-5.9 13.2-13.2 13.2H13.9C6.6 60.1.7 54.2.7 46.9c0-7.3 5.9-13.2 13.2-13.2H47z"+ fill="#36C5F0"+ />+ <path+ d="M99.9 46.9c0-7.3 5.9-13.2 13.2-13.2 7.3 0 13.2 5.9 13.2 13.2 0 7.3-5.9 13.2-13.2 13.2H99.9V46.9zm-6.6 0c0 7.3-5.9 13.2-13.2 13.2-7.3 0-13.2-5.9-13.2-13.2V13.8C66.9 6.5 72.8.6 80.1.6c7.3 0 13.2 5.9 13.2 13.2v33.1z"+ fill="#2EB67D"+ />+ <path+ d="M80.1 99.8c7.3 0 13.2 5.9 13.2 13.2 0 7.3-5.9 13.2-13.2 13.2-7.3 0-13.2-5.9-13.2-13.2V99.8h13.2zm0-6.6c-7.3 0-13.2-5.9-13.2-13.2 0-7.3 5.9-13.2 13.2-13.2h33.1c7.3 0 13.2 5.9 13.2 13.2 0 7.3-5.9 13.2-13.2 13.2H80.1z"+ fill="#ECB22E"+ />+ </svg>+);++export const WebhookChannelIcon = ({ className }: IconProps) => (+ <GlobeIcon+ className={`${className ?? DEFAULT_CLASSNAME} text-emerald-500 dark:text-emerald-400`}+ weight="duotone"+ aria-hidden+ />+);++export const WebpushChannelIcon = ({ className }: IconProps) => (+ <BellRingingIcon+ className={`${className ?? DEFAULT_CLASSNAME} text-amber-500 dark:text-amber-400`}+ weight="duotone"+ aria-hidden+ />+);diff --git a/docs/content/docs/accountsettings/teams-and-integrations.mdx b/docs/content/docs/accountsettings/teams-and-integrations.mdxindex f1794b7df..75ab0c47b 100644--- a/docs/content/docs/accountsettings/teams-and-integrations.mdx+++ b/docs/content/docs/accountsettings/teams-and-integrations.mdx@@ -29,19 +29,19 @@ To manage your team, go to the Organisations page and click the **Settings** (geYou can assign a project to an organisation in the **Project Settings -> Access** tab. Once assigned, all members of the organisation will have access to the project according to their organisation role.-## Integrations+## Notification channels-Swetrix can send you reports and alerts directly to your favourite communication tools.+Swetrix can send alerts directly to your favourite communication tools through **notification channels**. A channel describes _where_ a message is sent β your inbox, a Slack workspace, a Telegram chat, your own webhook, or a browser push subscription.-1. Go to your **[Account Settings](https://swetrix.com/user-settings)**.-2. Open the **Communications** tab.-3. Scroll down to the **Integrations** section.+You can connect channels at three different scopes:-Supported integrations:+- **Personal** β Available across all of your projects. Manage them in **[Account Settings β Communications β Notification channels](https://swetrix.com/user-settings?tab=communications)**.+- **Organisation** β Shared with everyone in an organisation (configured by owners and admins from the organisation's settings page).+- **Project** β Scoped to a single project, configured under **Project Settings β Notification channels**.-- **Telegram**: Receive alerts via the Swetrix Bot.-- **Slack**: Send notifications to a Slack channel via Webhook.-- **Discord**: Send notifications to a Discord channel via Webhook.+Supported channel types: **Email**, **Telegram** (via [@swetrixbot](https://t.me/swetrixbot)), **Discord** (incoming webhook), **Slack** (incoming webhook), **custom Webhook** (with optional HMAC signature), and **browser Web push** notifications.++For the full setup walkthrough, payload format, message-template variables, and per-alert channel selection, see the [Alerts & Notifications](/analytics-dashboard/alerts) guide.## Interface Settingsdiff --git a/docs/content/docs/analytics-dashboard/alerts.mdx b/docs/content/docs/analytics-dashboard/alerts.mdxindex 35bcb058b..f58f2ef0a 100644--- a/docs/content/docs/analytics-dashboard/alerts.mdx+++ b/docs/content/docs/analytics-dashboard/alerts.mdx@@ -1,67 +1,438 @@---id: alerts-title: Alerts+title: Alerts & Notificationssidebar_label: Alerts---<Callout type="info" title="Cloud Exclusive">-The Alerts feature is exclusively available on **Swetrix Cloud**. It is not currently available for self-hosted instances at the moment.+Alerts and notification channels are exclusively available on **Swetrix Cloud**. They are not currently available for self-hosted instances.</Callout>-Alerts allow you to monitor your website's performance in real-time and receive notifications when specific metrics cross a defined threshold. This helps you stay on top of traffic spikes, server errors, or important user interactions without constantly checking the dashboard.+Alerts let you monitor your website in real-time and get notified the moment a metric crosses a threshold you care about β traffic spikes, drops in active users, JavaScript errors after a deployment, or important custom events like signups and purchases. You stay on top of what matters without keeping a tab open on the dashboard all day.-<img alt="Alerts Dashboard" src="/docs/img/analytics-dashboard/alerts-list.png" />+Each alert is wired to one or more **notification channels** that decide _where_ the message is sent (email, Telegram, Discord, Slack, browser push, or your own webhook).-## Prerequisites+<img alt="Alerts overview" src="/docs/img/analytics-dashboard/alerts-list.png" />-Before setting up alerts, you must connect a notification channel to your account. Swetrix supports the following channels:+## Notification channels-- **Telegram**-- **Discord**-- **Slack**+Before you can create an alert, you need at least one notification channel. Channels are managed independently of alerts so you can re-use the same destination across many alerts (or send a single alert to several places at once).-To configure these, go to your **Account Settings** and follow the instructions for each integration. If no channel is connected, you will see a warning on the Alerts page.+### Supported channel types-<img- alt="Alert communication channels"- src="/docs/img/accountsettings/communication-channels.png"-/>+| Channel | What it does | Verification |+| ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------- |+| <span className="inline-flex items-center gap-1.5 whitespace-nowrap"><EmailChannelIcon /> **Email**</span> | Delivers a rich HTML email with a one-click unsubscribe link. | Confirmation email |+| <span className="inline-flex items-center gap-1.5 whitespace-nowrap"><TelegramChannelIcon /> **Telegram**</span> | Sends messages via the [@swetrixbot](https://t.me/swetrixbot) bot to your private chat. | Linked through the bot |+| <span className="inline-flex items-center gap-1.5 whitespace-nowrap"><DiscordChannelIcon /> **Discord**</span> | Posts to a Discord channel via an incoming webhook URL. | Validated on save |+| <span className="inline-flex items-center gap-1.5 whitespace-nowrap"><SlackChannelIcon /> **Slack**</span> | Posts to a Slack channel via an incoming webhook URL. | Validated on save |+| <span className="inline-flex items-center gap-1.5 whitespace-nowrap"><WebhookChannelIcon /> **Webhook**</span> | Sends a JSON `POST` to a URL of your choice with an optional HMAC-SHA256 signature. | Webhook ping |+| <span className="inline-flex items-center gap-1.5 whitespace-nowrap"><WebpushChannelIcon /> **Web push**</span> | Native browser push notifications for the device you subscribe from (desktop or mobile). | Verified on subscribe |-## Creating an Alert+### Channel scopes-1. Navigate to your project's **Settings** and click on the **Alerts** tab.-2. Click the **Add Alert** button.-3. Configure the alert settings:- - **Name**: A descriptive name for your alert (e.g., "High Traffic Warning").- - **Metric**: The data point you want to monitor (see below).- - **Condition**: The logic to trigger the alert (e.g., Greater than, Less than).- - **Value**: The threshold number.- - **Timeframe**: The period over which the data is analyzed (e.g., "Last 15 minutes").+Channels live at one of three scopes, which controls who can use them and where they appear:++- **User** β Personal channels you own. Available across all of your projects (and any project you have admin rights on). Manage them in **Account Settings β Communications β Notification channels**.+- **Organisation** β Shared with everyone in an organisation. Useful for a team-wide #alerts Slack channel or an on-call email distribution list. Managed in **Organisation Settings β Notification channels** by organisation owners and admins.+- **Project** β Specific to a single project. Handy when one site needs to notify a different audience than the rest. Managed in **Project Settings β Notification channels**.++When you build an alert, you can pick from any channel that is in scope for that project β your personal channels, the project's organisation channels, and the project's own channels are all available in the picker.++### Connecting a channel++<Steps>++<Step>++### Open the right Notification channels page++Decide which scope you want the channel to live at (User / Organisation / Project β see above) and open that scope's **Notification channels** section.++</Step>++<Step>++### Click "Add channel" and pick a type++<img alt="Connect a channel" src="/docs/img/analytics-dashboard/alert-conect-a-channel.png" />++Each type has slightly different details. Pick the tab below that matches the destination you want to wire up.++<Tabs defaultValue="email">+<TabsList>+ <TabsTrigger value="email"><EmailChannelIcon /> Email</TabsTrigger>+ <TabsTrigger value="telegram"><TelegramChannelIcon /> Telegram</TabsTrigger>+ <TabsTrigger value="discord"><DiscordChannelIcon /> Discord</TabsTrigger>+ <TabsTrigger value="slack"><SlackChannelIcon /> Slack</TabsTrigger>+ <TabsTrigger value="webhook"><WebhookChannelIcon /> Webhook</TabsTrigger>+ <TabsTrigger value="webpush"><WebpushChannelIcon /> Web push</TabsTrigger>+</TabsList>++<TabsContent value="email">++Enter the destination address. Swetrix sends a confirmation email with a one-click verification link β the channel stays in the **Pending verification** state until that link is clicked.++Every alert email includes a one-click **Unsubscribe** link in the footer. If a recipient clicks it, the channel is marked **Unsubscribed** and Swetrix stops sending alerts to that address until you re-verify it.++</TabsContent>++<TabsContent value="telegram">++1. Open [@swetrixbot](https://t.me/swetrixbot) on Telegram.+2. Send `/start`. The bot replies with your numeric chat ID.+3. Paste that chat ID into the **Telegram chat ID** field.++The channel is verified automatically once linked through the bot.++</TabsContent>++<TabsContent value="discord">++Paste the **incoming webhook URL** from your Discord server's channel settings (Server Settings β Integrations β Webhooks β New Webhook β Copy Webhook URL).++Only `https://discord.com/...` URLs are accepted. The channel is validated and marked verified on save.++</TabsContent>++<TabsContent value="slack">++Paste the **incoming webhook URL** from your Slack workspace ([Slack apps β Incoming Webhooks β Add New Webhook to Workspace](https://api.slack.com/messaging/webhooks)).++Only `https://hooks.slack.com/...` URLs are accepted. The channel is validated and marked verified on save.++</TabsContent>++<TabsContent value="webhook">++Enter any `https://` URL that should receive the JSON payload. Optionally add a **signing secret** β when set, every request includes an `X-Swetrix-Signature: sha256=<hex>` header so you can verify the body wasn't tampered with.++Webhook channels stay **Pending verification** until you click **Verify** in the channel list β Swetrix sends a one-off ping that your endpoint must respond to with a `2xx` status within 5 seconds. See [Webhook payload](#webhook-payload) below for the exact JSON shape.++</TabsContent>++<TabsContent value="webpush">++Web push is a **User-scope** channel only. From your account's notification channels page, click **Enable browser notifications**:++1. Your browser asks for notification permission.+2. Swetrix registers a service worker (`/sw.js`).+3. The current device is registered as a channel and verified immediately.++You can enable web push on multiple devices β each one becomes its own channel.++<Callout type="warn">++Push notifications only fire while the browser is running (or, on supported platforms, in the background). They are not a substitute for email or webhook delivery if you need guaranteed receipt.++</Callout>++</TabsContent>++</Tabs>++</Step>++<Step>++### Name the channel and save++Give it a descriptive name (e.g. "Engineering Slack" or "On-call email") and click **Create**. Channels that need verification will show a **Pending verification** badge until they're confirmed.++</Step>++<Step>++### Send a test message (optional)++Use the **Send test** button (paper-plane icon) on the channel row to dispatch a sample message right away β it works even before verification, so you can confirm the destination is wired up correctly.++</Step>++</Steps>++### Webhook payload++Custom webhook channels receive a JSON `POST` with this shape:++```json+{+ "type": "alert",+ "subject": "[Swetrix] High traffic alert triggered",+ "body": "π Alert *High traffic alert* triggered!\n\nProject: ...",+ "context": {+ "alert_name": "High traffic alert",+ "project_name": "My website",+ "project_id": "abcdef",+ "dashboard_url": "https://swetrix.com/projects/abcdef",+ "value": 1234,+ "threshold": 1000,+ "condition": "greater than",+ "time_window": "1 hour",+ "metric": "page_views"+ },+ "timestamp": "2026-04-24T10:00:00.000Z"+}+```++If you configured a signing secret, every request also carries this header:++```+X-Swetrix-Signature: sha256=<hmac of the raw body>+```++<Callout type="warn">++Always verify the signature on your side. Compute `HMAC-SHA256(secret, raw_request_body)` and compare it to the value after `sha256=` using a constant-time comparison β this guarantees the request really came from Swetrix and wasn't replayed or modified in transit.++</Callout>++The verification ping uses the same headers but a smaller payload: `{ "type": "verification", "timestamp": "..." }`.++## Creating an alert++<Steps>++<Step>++### Open the project's alerts page++In your project, go to **Settings β Alerts** and click **Add alert**.++</Step>++<Step>++### Fill in the basics++Give the alert a short, human-readable name (e.g. "Homepage traffic dip") and decide whether it should be **Enabled**. Disabled alerts never fire β useful for temporarily silencing an alert without deleting it.++</Step>++<Step>++### Configure the trigger++Pick **what** fires the alert:++- **Metric** β Which data point to monitor (see [Supported metrics](#supported-metrics) below).+- **Condition** β `greater than`, `greater than or equal to`, `less than`, or `less than or equal to`.+- **Threshold** β The number the metric is compared against.+- **Time window** β `15 minutes`, `30 minutes`, `1 hour`, `4 hours`, `24 hours`, or `48 hours`. Swetrix evaluates the metric over this rolling window.++Two metric-specific options change the form:++- **Custom events** β Provide the event name (e.g. `signup`). Tick **Alert on every custom event** to fire on _every_ occurrence and skip the threshold/time-window settings.+- **Errors** β Tick **Alert on new errors only** to be notified just for the first occurrence of each new error (great for catching regressions after a release).++</Step>++<Step>++### Pick the notification channels++The picker shows every channel in scope for the project β personal, organisational, and project-specific β with their current verification status. Tick as many as you like (e.g. send to your team's Slack and your personal Telegram at the same time).++If no channels are connected yet, the picker links straight to **Project Settings β Notification channels** so you can add one.++</Step>++<Step>++### Customise the message (optional)++Decide _what_ Swetrix says when the alert fires. Leave the message blank to use the sensible default for the chosen metric, or write your own using **Markdown** and **Handlebars** variables β see the next section.++</Step>++</Steps><img alt="Create an alert" src="/docs/img/analytics-dashboard/create-an-alert.png" />-### Supported Metrics+## Message templates++Type `{` in the editor (or click any chip below it) to insert a variable. The body supports a common subset of Markdown β bold, italics, links, inline `code`, lists, and line breaks. Use the **Preview** button to see exactly how the message will render with sample values.++<Callout type="info">++Different destinations format Markdown a little differently β Telegram and Slack treat single `*text*` as **bold**, while CommonMark treats it as italic. Swetrix normalises this so the preview matches what your recipients actually see.++</Callout>++### Common variables++Available for every alert:++| Variable | Meaning |+| ------------------- | ---------------------------------------------- |+| `{{alert_name}}` | The alert's name, as configured in the form. |+| `{{project_name}}` | The project this alert belongs to. |+| `{{project_id}}` | The project's unique identifier. |+| `{{dashboard_url}}` | Direct link to the project dashboard. |+| `{{value}}` | The metric value that triggered the alert. |+| `{{threshold}}` | The threshold the value was compared against. |+| `{{condition}}` | The comparison operator (e.g. "greater than"). |+| `{{time_window}}` | The window the metric was measured over. |++### Metric-specific variables++Each metric exposes a few extras of its own:++<Accordions>++<Accordion title="Page views">++| Variable | Meaning |+| ----------- | ----------------------------------- |+| `{{views}}` | Number of page views in the window. |++</Accordion>++<Accordion title="Unique sessions">++| Variable | Meaning |+| ------------------ | ---------------------------------------- |+| `{{unique_views}}` | Number of unique sessions in the window. |++</Accordion>++<Accordion title="Online users">++| Variable | Meaning |+| ------------------ | ----------------------- |+| `{{online_count}}` | Currently online users. |++</Accordion>++<Accordion title="Custom events">++| Variable | Meaning |+| ---------------------- | ---------------------------------------------- |+| `{{event_name}}` | The custom event's name. |+| `{{event_count}}` | Number of times the event fired in the window. |+| `{{every_event_mode}}` | `yes` if the alert fires on every occurrence. |++</Accordion>++<Accordion title="Errors">++| Variable | Meaning |+| ------------------- | ---------------------------------------------------- |+| `{{error_count}}` | Number of errors that triggered the alert. |+| `{{error_message}}` | The error message text. |+| `{{error_name}}` | The error's class or name. |+| `{{errors_url}}` | Direct link to the project's errors view. |+| `{{is_new_only}}` | `yes` if the alert only fires for first-seen errors. |++</Accordion>++</Accordions>++### Default templates++Swetrix ships with two defaults that use these variables:++```+π Alert *{{alert_name}}* triggered!++Project: [{{project_name}}]({{dashboard_url}})+Value: *{{value}}* {{condition}} *{{threshold}}* in the last {{time_window}}.+```++For error alerts:++```+π Error alert *{{alert_name}}* triggered!++Project: [{{project_name}}]({{dashboard_url}})+Error: `{{error_name}}`+Message: `{{error_message}}`++[View error]({{errors_url}})+```++### Email subject++If at least one of the alert's selected channels is an **Email** channel, an **Email subject** field appears above the body. Variables work here too. The default is:++```+[Swetrix] {{alert_name}} triggered+```++<img alt="Alerts overview" src="/docs/img/analytics-dashboard/alert-template-editor.png" />++## Supported metrics++You can create alerts based on any of these metrics:++- **Page views** β Total page views in the time window.+- **Unique sessions** β Number of distinct sessions in the time window.+- **Online users** β How many visitors are currently active on your site.+- **Custom events** β Watch a specific event by name, or alert on _every_ custom event.+- **Errors** β Track JavaScript errors. Choose between every error or only **new** ones (handy after a deployment).++## Managing alerts++All of a project's alerts are listed under **Project Settings β Alerts**. From there you can:++- **Edit** β Click the pencil icon (or anywhere on the row) to change thresholds, channels, or the message template.+- **Delete** β Click the trash icon to remove an alert permanently.+- **Disable** β Toggle the **Enabled** switch in the alert form to silence it without deleting.+- **See the last triggered time** β Each row displays when the alert most recently fired, so you can spot noisy alerts quickly.++## Example use cases++<Accordions>++<Accordion title="Traffic spike β notify the team Slack">++Pick the **Online users** metric, condition **greater than**, threshold `100`, time window **15 minutes**. Attach an organisation-scope **Slack** channel. The team gets pinged the moment your site goes viral.++</Accordion>++<Accordion title="Traffic drop β notify your personal email">++Pick **Unique sessions**, condition **less than**, threshold `50`, time window **1 hour**. Attach a personal **Email** channel. You'll know immediately if a deployment took the site down or a tracking script broke.++</Accordion>++<Accordion title="Signup goal β fire a webhook on every signup">++Pick the **Custom events** metric, set the event name to `signup`, and tick **Alert on every custom event**. Attach a **Webhook** channel pointing to your CRM/Zapier endpoint to record each new signup the moment it happens.++</Accordion>++<Accordion title="Post-deploy regressions β Telegram on new errors only">++Pick the **Errors** metric and tick **Alert on new errors only**. Attach a personal **Telegram** channel. After every release you'll only hear about errors that have never been seen before β perfect for catching regressions without noise.++</Accordion>++<Accordion title="Revenue spike β Discord on big purchase volume">++Pick **Custom events**, event name `purchase`, condition **greater than**, threshold `10`, time window **24 hours**. Attach a **Discord** channel pointing at your `#revenue` server channel.++</Accordion>-You can create alerts based on the following metrics:+</Accordions>-- **Pageviews**: Total number of pages viewed.-- **Unique Pageviews**: Number of unique visitors.-- **Online Users**: Current number of active users on your site.-- **Custom Events**: Monitor specific interactions (e.g., "Signup Button Click"). You can track a specific event by name or alert on _every_ custom event.-- **Errors**: Track JavaScript errors occurring on your site. You can choose to be notified about all errors or only **new** errors that haven't been seen before.+## Related-## Managing Alerts+<Cards>-Once created, your alerts will appear in a list on the Alerts tab in your project settings.+<Card title="Error tracking" href="/analytics-dashboard/error-tracking">+ Pair error alerts with the dedicated error dashboard for stack traces, affected sessions, and+ resolution workflow.+</Card>-- **Edit**: Click the **Pencil** icon to modify the alert's threshold or settings.-- **Delete**: Click the **Trash** icon to remove the alert permanently.-- **Status**: Alerts show their last triggered time, helping you understand their frequency.+<Card title="Email reports" href="/email-reports">+ Recurring traffic summaries delivered to your inbox β complementary to real-time alerts.+</Card>-## Example Use Cases+<Card title="Teams & Integrations" href="/teams-api-integrations">+ Set up organisation-scope channels so your whole team gets the same alerts.+</Card>-- **Traffic Spike**: Notify me if **Online Users** is greater than **100**.-- **Error Monitoring**: Notify me on **New Errors** (useful for post-deployment monitoring).-- **Goal Tracking**: Notify me if **Custom Event** "Purchase" count is greater than **10** in the last **1 hour**.+</Cards>diff --git a/docs/content/docs/sitesettings/get-traffic-alerts.mdx b/docs/content/docs/sitesettings/get-traffic-alerts.mdxdeleted file mode 100644index 3f75ebc00..000000000--- a/docs/content/docs/sitesettings/get-traffic-alerts.mdx+++ /dev/null@@ -1,40 +0,0 @@-----title: Get traffic alerts-slug: /get-traffic-alerts------You can set up alerts to get notified when your website's traffic exceeds a certain threshold, or when a certain custom event occurs (like sale, or a signup). You can also set up alerts to be notified when there are client-side errors on your website.--You can set up integrations with Telegram, Slack or Discord to get alert notifications in real-time there.--### Connect your Slack, Telegram or Discord--On the [account settings page](https://swetrix.com/user-settings), go to the "Communication" section. There you will see the list of currently supported integrations by Swetrix, and their status (connected or not).--To connect an integration, click on the "Add integration" button and follow the instructions.--<img alt="Connect integrations screen" src="/docs/img/sitesettings/connect_integrations.png" />--### How to set up traffic alerts--After you connected your integration, all the alerts will be sent there. You can set up alerts for different projects (websites) and they all will trigger independent of each other.--To set up an alert,--1. Go to your website's analytics page.-2. Open the project **Settings** (gear icon in the sidebar).-3. Navigate to the **Alerts** tab.-4. Click on the "Add alert" button.--<img alt="Alerts screen" src="/docs/img/sitesettings/set_up_alert.png" />--When you click on the "Add alert" button, you will see a screen where you can create a new alert. You can set it up to trigger for different metrics, for example:--- when the number of pageviews exceeds a certain threshold (traffic spikes)-- when the number of online users is less than 10-- on every custom event (like a sale, or a signup)-- on every new error on your website-- when the number of users on your website is less than 5 during the last 24 hours-- ... and more--From the same "Alerts" tab in project settings you can also see the list of all the alerts you have set up and the last time they triggered. You can edit or delete them by clicking on the "Edit" or "Delete" buttons.diff --git a/docs/content/docs/sitesettings/meta.json b/docs/content/docs/sitesettings/meta.jsonindex 9474523e4..03cd1b2e8 100644--- a/docs/content/docs/sitesettings/meta.json+++ b/docs/content/docs/sitesettings/meta.json@@ -7,7 +7,6 @@"transfer-ownership","embed-your-analytics-dashboard-into-your-website","get-analytics-email-reports",- "get-traffic-alerts","reset-sites-data","annotations"]diff --git a/docs/lib/source.ts b/docs/lib/source.tsindex 343ca86b5..af95104e9 100644--- a/docs/lib/source.ts+++ b/docs/lib/source.ts@@ -27,7 +27,6 @@ const SLUG_MAP: Record<string, string[]> = {"sitesettings/transfer-ownership": ["how-to-transfer-ownership-of-your-website"],"sitesettings/embed-your-analytics-dashboard-into-your-website": ["how-to-embed"],"sitesettings/get-analytics-email-reports": ["get-analytics-email-reports"],- "sitesettings/get-traffic-alerts": ["get-traffic-alerts"],"sitesettings/reset-sites-data": ["reset-sites-data"],"sitesettings/annotations": ["annotations"],diff --git a/docs/mdx-components.tsx b/docs/mdx-components.tsxindex aef610b48..2307cb6bb 100644--- a/docs/mdx-components.tsx+++ b/docs/mdx-components.tsx@@ -10,6 +10,14 @@ import {PlausibleIcon,NpmIcon,} from "@/components/provider-icons";+import {+ EmailChannelIcon,+ TelegramChannelIcon,+ DiscordChannelIcon,+ SlackChannelIcon,+ WebhookChannelIcon,+ WebpushChannelIcon,+} from "@/components/channel-icons";import { Accordion, Accordions } from "fumadocs-ui/components/accordion";import { File, Folder, Files } from "fumadocs-ui/components/files";import { CodeIcon } from "@phosphor-icons/react/dist/ssr";@@ -32,6 +40,12 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {FathomIcon,PlausibleIcon,NpmIcon,+ EmailChannelIcon,+ TelegramChannelIcon,+ DiscordChannelIcon,+ SlackChannelIcon,+ WebhookChannelIcon,+ WebpushChannelIcon,CodeIcon,Accordion,Accordions,diff --git a/docs/public/img/analytics-dashboard/alert-conect-a-channel.png b/docs/public/img/analytics-dashboard/alert-conect-a-channel.pngnew file mode 100644index 000000000..cee7267f4Binary files /dev/null and b/docs/public/img/analytics-dashboard/alert-conect-a-channel.png differdiff --git a/docs/public/img/analytics-dashboard/alert-template-editor.png b/docs/public/img/analytics-dashboard/alert-template-editor.pngnew file mode 100644index 000000000..0eea77f6aBinary files /dev/null and b/docs/public/img/analytics-dashboard/alert-template-editor.png differdiff --git a/docs/public/img/analytics-dashboard/alerts-list.png b/docs/public/img/analytics-dashboard/alerts-list.pngindex 0d6ae1e24..5ce35702a 100644Binary files a/docs/public/img/analytics-dashboard/alerts-list.png and b/docs/public/img/analytics-dashboard/alerts-list.png differdiff --git a/docs/public/img/analytics-dashboard/create-an-alert.png b/docs/public/img/analytics-dashboard/create-an-alert.pngindex c2250fdff..5256da892 100644Binary files a/docs/public/img/analytics-dashboard/create-an-alert.png and b/docs/public/img/analytics-dashboard/create-an-alert.png differ