🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Add new translation keys for custom event tracking and enhance UI components
Bill Yang3a384379ca2c
diff --git a/client/messages/cs.json b/client/messages/cs.jsonindex 660d4d791..58bcd061f 100644--- a/client/messages/cs.json+++ b/client/messages/cs.json@@ -1289,6 +1289,11 @@"jsy7pk": "Zkusit znovu","hyfdry": "Zobrazení stránky","TH+8LD": "Změna vstupu",+ "Q5w7w4": "Vlastní události se nezaznamenávají automaticky. Váš web je musí odesílat pomocí rybbit.event().",+ "/Z2fqW": "Odchozí odkaz",+ "/6bl6s": "Kliknutí na tlačítko",+ "bsPwts": "Odeslání formuláře",+ "DP+/qk": "Sledování typu {type} je pro tento web vypnuté, takže se tyto události neshromažďují. Můžete ho zapnout na kartě Sledování v nastavení webu.","yQUiLi": "Načítám data o využití...","xIpQN1": "Nepodařilo se načíst data o využití","mJ4u5H": "Bezplatný plán: Využito {used} z {limit} událostí",diff --git a/client/messages/de.json b/client/messages/de.jsonindex cb33da8b1..d4ac70975 100644--- a/client/messages/de.json+++ b/client/messages/de.json@@ -1289,6 +1289,11 @@"jsy7pk": "Erneut versuchen","hyfdry": "Seitenaufruf","TH+8LD": "Eingabeänderung",+ "Q5w7w4": "Custom Events werden nicht automatisch erfasst. Ihre Website muss sie mit rybbit.event() senden.",+ "/Z2fqW": "Ausgehender Link",+ "/6bl6s": "Button-Klick",+ "bsPwts": "Formularübermittlung",+ "DP+/qk": "Das {type}-Tracking ist für diese Website deaktiviert, daher werden diese Events nicht erfasst. Sie können es im Tracking-Tab der Website-Einstellungen aktivieren.","yQUiLi": "Nutzungsdaten werden geladen...","xIpQN1": "Nutzungsdaten konnten nicht geladen werden","mJ4u5H": "Kostenloser Plan: {used} von {limit} Events verbraucht",diff --git a/client/messages/en.json b/client/messages/en.jsonindex 35e73ae6f..54a7294ea 100644--- a/client/messages/en.json+++ b/client/messages/en.json@@ -1289,6 +1289,11 @@"jsy7pk": "Try Again","hyfdry": "Pageview","TH+8LD": "Input Change",+ "Q5w7w4": "Custom events aren't captured automatically. Your site has to send them with rybbit.event().",+ "/Z2fqW": "Outbound link",+ "/6bl6s": "Button click",+ "bsPwts": "Form submission",+ "DP+/qk": "{type} tracking is turned off for this site, so these events aren't being collected. You can turn it on in the Tracking tab of the site settings.","yQUiLi": "Loading usage data...","xIpQN1": "Failed to load usage data","mJ4u5H": "Free plan: Using {used} of {limit} events",diff --git a/client/messages/es.json b/client/messages/es.jsonindex 71239d0a1..a94a4f4b1 100644--- a/client/messages/es.json+++ b/client/messages/es.json@@ -1289,6 +1289,11 @@"jsy7pk": "Intentar de nuevo","hyfdry": "Vista de página","TH+8LD": "Cambio de entrada",+ "Q5w7w4": "Los eventos personalizados no se capturan automáticamente. Tu sitio debe enviarlos con rybbit.event().",+ "/Z2fqW": "Enlace saliente",+ "/6bl6s": "Clic en botón",+ "bsPwts": "Envío de formulario",+ "DP+/qk": "El seguimiento de {type} está desactivado para este sitio, por lo que estos eventos no se están recopilando. Puedes activarlo en la pestaña Seguimiento de la configuración del sitio.","yQUiLi": "Cargando datos de uso...","xIpQN1": "Error al cargar datos de uso","mJ4u5H": "Plan gratuito: Usando {used} de {limit} eventos",diff --git a/client/messages/fr.json b/client/messages/fr.jsonindex 85305346d..669ddba85 100644--- a/client/messages/fr.json+++ b/client/messages/fr.json@@ -1289,6 +1289,11 @@"jsy7pk": "Réessayer","hyfdry": "Page vue","TH+8LD": "Changement de saisie",+ "Q5w7w4": "Les événements personnalisés ne sont pas capturés automatiquement. Votre site doit les envoyer avec rybbit.event().",+ "/Z2fqW": "Lien sortant",+ "/6bl6s": "Clic sur bouton",+ "bsPwts": "Soumission de formulaire",+ "DP+/qk": "Le suivi {type} est désactivé pour ce site, donc ces événements ne sont pas collectés. Vous pouvez l'activer dans l'onglet Suivi des paramètres du site.","yQUiLi": "Chargement des données d'utilisation...","xIpQN1": "Échec du chargement des données d'utilisation","mJ4u5H": "Plan gratuit : {used} sur {limit} événements utilisés",diff --git a/client/messages/it.json b/client/messages/it.jsonindex 661d0e173..ba83dae12 100644--- a/client/messages/it.json+++ b/client/messages/it.json@@ -1289,6 +1289,11 @@"jsy7pk": "Riprova","hyfdry": "Visualizzazione pagina","TH+8LD": "Modifica input",+ "Q5w7w4": "Gli eventi personalizzati non vengono acquisiti automaticamente. Il tuo sito deve inviarli con rybbit.event().",+ "/Z2fqW": "Link in uscita",+ "/6bl6s": "Clic su pulsante",+ "bsPwts": "Invio modulo",+ "DP+/qk": "Il tracciamento di {type} è disattivato per questo sito, quindi questi eventi non vengono raccolti. Puoi attivarlo nella scheda Tracciamento delle impostazioni del sito.","yQUiLi": "Caricamento dati di utilizzo...","xIpQN1": "Impossibile caricare i dati di utilizzo","mJ4u5H": "Piano gratuito: Utilizzati {used} di {limit} eventi",diff --git a/client/messages/ja.json b/client/messages/ja.jsonindex 50fd6c4d5..109962527 100644--- a/client/messages/ja.json+++ b/client/messages/ja.json@@ -1289,6 +1289,11 @@"jsy7pk": "再試行","hyfdry": "ページビュー","TH+8LD": "入力変更",+ "Q5w7w4": "カスタムイベントは自動的には収集されません。サイト側から rybbit.event() で送信する必要があります。",+ "/Z2fqW": "外部リンク",+ "/6bl6s": "ボタンクリック",+ "bsPwts": "フォーム送信",+ "DP+/qk": "{type}のトラッキングがこのサイトでは無効になっているため、これらのイベントは収集されていません。サイト設定のトラッキングタブで有効にできます。","yQUiLi": "使用量データを読み込み中...","xIpQN1": "使用量データの読み込みに失敗しました","mJ4u5H": "無料プラン:{limit}イベント中{used}使用",diff --git a/client/messages/ko.json b/client/messages/ko.jsonindex 90f9132cf..787c45260 100644--- a/client/messages/ko.json+++ b/client/messages/ko.json@@ -1289,6 +1289,11 @@"jsy7pk": "다시 시도","hyfdry": "페이지뷰","TH+8LD": "입력 변경",+ "Q5w7w4": "사용자 지정 이벤트는 자동으로 수집되지 않습니다. 사이트에서 rybbit.event()로 직접 전송해야 합니다.",+ "/Z2fqW": "외부 링크",+ "/6bl6s": "버튼 클릭",+ "bsPwts": "폼 제출",+ "DP+/qk": "이 사이트에서는 {type} 추적이 꺼져 있어 해당 이벤트가 수집되지 않습니다. 사이트 설정의 추적 탭에서 켤 수 있습니다.","yQUiLi": "사용량 데이터 로딩 중...","xIpQN1": "사용량 데이터 로드 실패","mJ4u5H": "무료 플랜: {limit}개 이벤트 중 {used}개 사용",diff --git a/client/messages/pl.json b/client/messages/pl.jsonindex 1ce9989f4..ab5ed43c6 100644--- a/client/messages/pl.json+++ b/client/messages/pl.json@@ -1289,6 +1289,11 @@"jsy7pk": "Spróbuj ponownie","hyfdry": "Odsłona","TH+8LD": "Zmiana danych wejściowych",+ "Q5w7w4": "Zdarzenia niestandardowe nie są rejestrowane automatycznie. Twoja witryna musi je wysyłać za pomocą rybbit.event().",+ "/Z2fqW": "Link wychodzący",+ "/6bl6s": "Kliknięcie przycisku",+ "bsPwts": "Wysłanie formularza",+ "DP+/qk": "Śledzenie typu {type} jest wyłączone dla tej witryny, więc te zdarzenia nie są zbierane. Możesz je włączyć w zakładce Śledzenie w ustawieniach witryny.","yQUiLi": "Ładowanie danych o wykorzystaniu...","xIpQN1": "Nie udało się załadować danych o wykorzystaniu","mJ4u5H": "Darmowy plan: Wykorzystano {used} z {limit} zdarzeń",diff --git a/client/messages/pt.json b/client/messages/pt.jsonindex 194a51d2e..d695f8ea0 100644--- a/client/messages/pt.json+++ b/client/messages/pt.json@@ -1289,6 +1289,11 @@"jsy7pk": "Tentar Novamente","hyfdry": "Visualização de página","TH+8LD": "Alteração de entrada",+ "Q5w7w4": "Eventos personalizados não são capturados automaticamente. Seu site precisa enviá-los com rybbit.event().",+ "/Z2fqW": "Link de saída",+ "/6bl6s": "Clique em botão",+ "bsPwts": "Envio de formulário",+ "DP+/qk": "O rastreamento de {type} está desativado para este site, então esses eventos não estão sendo coletados. Você pode ativá-lo na aba Rastreamento das configurações do site.","yQUiLi": "Carregando dados de uso...","xIpQN1": "Falha ao carregar dados de uso","mJ4u5H": "Plano gratuito: Usando {used} de {limit} eventos",diff --git a/client/messages/uk.json b/client/messages/uk.jsonindex 424772e48..71c40ba60 100644--- a/client/messages/uk.json+++ b/client/messages/uk.json@@ -1289,6 +1289,11 @@"jsy7pk": "Спробувати ще раз","hyfdry": "Перегляд сторінки","TH+8LD": "Зміна поля вводу",+ "Q5w7w4": "Користувацькі події не фіксуються автоматично. Ваш сайт має надсилати їх за допомогою rybbit.event().",+ "/Z2fqW": "Вихідне посилання",+ "/6bl6s": "Клік по кнопці",+ "bsPwts": "Надсилання форми",+ "DP+/qk": "Відстеження типу {type} вимкнено для цього сайту, тому ці події не збираються. Ви можете ввімкнути його на вкладці Відстеження в налаштуваннях сайту.","yQUiLi": "Завантаження даних про використання...","xIpQN1": "Не вдалося завантажити дані про використання","mJ4u5H": "Безкоштовний план: Використано {used} із {limit} подій",diff --git a/client/messages/zh.json b/client/messages/zh.jsonindex 4ad912e74..769883d16 100644--- a/client/messages/zh.json+++ b/client/messages/zh.json@@ -1289,6 +1289,11 @@"jsy7pk": "再试一次","hyfdry": "页面浏览","TH+8LD": "输入更改",+ "Q5w7w4": "自定义事件不会自动采集,需要您的网站通过 rybbit.event() 发送。",+ "/Z2fqW": "出站链接",+ "/6bl6s": "按钮点击",+ "bsPwts": "表单提交",+ "DP+/qk": "此网站已关闭{type}追踪,因此不会收集这些事件。您可以在网站设置的追踪标签页中开启。","yQUiLi": "正在加载使用情况数据...","xIpQN1": "加载使用情况数据失败","mJ4u5H": "免费计划:已使用 {used}/{limit} 个事件",diff --git a/client/src/app/[site]/funnels/components/FunnelForm.tsx b/client/src/app/[site]/funnels/components/FunnelForm.tsxindex f9023e2ca..5f328c670 100644--- a/client/src/app/[site]/funnels/components/FunnelForm.tsx+++ b/client/src/app/[site]/funnels/components/FunnelForm.tsx@@ -21,6 +21,7 @@ import { ThreeDotLoader } from "../../../../components/Loaders";import { Label } from "../../../../components/ui/label";import { Switch } from "../../../../components/ui/switch";import { EventTypeIcon } from "../../../../components/EventIcons";+import { EventTrackingNotice } from "../../../../components/EventTrackingNotice";import { isAutocaptureTargetType, targetTypeToEventType } from "../../../../lib/events";import { Funnel } from "./Funnel";@@ -147,6 +148,7 @@ function StepCard({onChange={e => onFieldChange("value", e.target.value)}/>{urlError && <p className="mt-1 text-xs text-red-500">{t("Enter a path (e.g., /checkout), not a full URL.")}</p>}+ <EventTrackingNotice type={step.type} className="mt-2" /></div>{expanded && (diff --git a/client/src/app/[site]/goals/components/GoalFormModal.tsx b/client/src/app/[site]/goals/components/GoalFormModal.tsxindex 7b4500590..461f4da8a 100644--- a/client/src/app/[site]/goals/components/GoalFormModal.tsx+++ b/client/src/app/[site]/goals/components/GoalFormModal.tsx@@ -11,6 +11,7 @@ import { useUpdateGoal } from "../../../../api/analytics/hooks/goals/useUpdateGoimport { useAutocaptureValues } from "../../../../api/analytics/hooks/events/useAutocaptureValues";import { useMetric } from "../../../../api/analytics/hooks/useGetMetric";import { EventTypeIcon } from "../../../../components/EventIcons";+import { EventTrackingNotice } from "../../../../components/EventTrackingNotice";import {AUTOCAPTURE_TARGET_TYPES,AutocaptureTargetType,@@ -551,6 +552,7 @@ export default function GoalFormModal({/></FormControl><FormMessage />+ <EventTrackingNotice type="event" className="mt-1" /></FormItem>)}/>@@ -575,6 +577,7 @@ export default function GoalFormModal({{autocaptureFieldMeta[goalType].help}{" "}{t("Use * to match within a segment. Use ** to match anything.")}</div>+ <EventTrackingNotice type={goalType} className="mt-1" /></FormItem>)}/>diff --git a/client/src/components/EventTrackingNotice.tsx b/client/src/components/EventTrackingNotice.tsxnew file mode 100644index 000000000..2b11acfbf--- /dev/null+++ b/client/src/components/EventTrackingNotice.tsx@@ -0,0 +1,84 @@+"use client";++import { TriangleAlert } from "lucide-react";+import { useExtracted } from "next-intl";+import { SiteResponse } from "../api/admin/endpoints";+import { useGetSite } from "../api/admin/hooks/useSites";+import { AutocaptureTargetType, isAutocaptureTargetType } from "../lib/events";+import { cn } from "../lib/utils";++// Defaults mirror the server column defaults surfaced in SiteSettings/TrackingTab.tsx:+// outbound tracking is on unless disabled, the rest are opt-in+function isTypeTracked(site: SiteResponse, type: AutocaptureTargetType): boolean {+ switch (type) {+ case "outbound":+ return site.trackOutbound ?? true;+ case "button_click":+ return site.trackButtonClicks ?? false;+ case "form_submit":+ return site.trackFormInteractions ?? false;+ case "copy":+ return site.trackCopy ?? false;+ }+}++interface EventTrackingNoticeProps {+ // A goal type ("path"/"event"/autocapture) or funnel step type ("page"/...)+ type: string;+ className?: string;+}++/**+ * Inline notice for goal/funnel target types that don't collect data out of+ * the box: custom events must be sent from the site's code, and autocapture+ * types only collect data while enabled in the site's tracking settings.+ * Renders nothing for types that are tracked (pageviews are always on).+ */+export function EventTrackingNotice({ type, className }: EventTrackingNoticeProps) {+ const t = useExtracted();+ const { data: site } = useGetSite();++ if (type === "event") {+ return (+ <p className={cn("text-xs leading-relaxed text-neutral-500 dark:text-neutral-400", className)}>+ {t("Custom events aren't captured automatically. Your site has to send them with rybbit.event().")}{" "}+ <a+ href="https://www.rybbit.io/docs/track-events"+ target="_blank"+ rel="noopener noreferrer"+ className="underline underline-offset-2 hover:text-neutral-700 dark:hover:text-neutral-200"+ >+ {t("Learn more")}+ </a>+ </p>+ );+ }++ if (!site || !isAutocaptureTargetType(type) || isTypeTracked(site, type)) {+ return null;+ }++ const typeLabels: Record<AutocaptureTargetType, string> = {+ outbound: t("Outbound link"),+ button_click: t("Button click"),+ form_submit: t("Form submission"),+ copy: t("Copy"),+ };++ return (+ <p+ className={cn(+ "flex items-start gap-1.5 text-xs leading-relaxed text-amber-600 dark:text-amber-400",+ className+ )}+ >+ <TriangleAlert className="mt-0.5 h-3.5 w-3.5 shrink-0" aria-hidden />+ <span>+ {t(+ "{type} tracking is turned off for this site, so these events aren't being collected. You can turn it on in the Tracking tab of the site settings.",+ { type: typeLabels[type] }+ )}+ </span>+ </p>+ );+}diff --git a/client/src/components/SiteSettings/TrackingTab.tsx b/client/src/components/SiteSettings/TrackingTab.tsxindex 8cac75252..614fbd59d 100644--- a/client/src/components/SiteSettings/TrackingTab.tsx+++ b/client/src/components/SiteSettings/TrackingTab.tsx@@ -1,5 +1,6 @@"use client";+import { useQueryClient } from "@tanstack/react-query";import { useExtracted } from "next-intl";import { useState, useCallback, ReactNode } from "react";import { toast } from "@/components/ui/sonner";@@ -34,6 +35,7 @@ interface ToggleConfig {export function TrackingTab({ siteMetadata, disabled = false }: TrackingTabProps) {const t = useExtracted();+ const queryClient = useQueryClient();const { refetch } = useGetSitesFromOrg(siteMetadata?.organizationId ?? "");const isMobileSite = siteMetadata.type === "mobile";@@ -69,6 +71,8 @@ export function TrackingTab({ siteMetadata, disabled = false }: TrackingTabProps: `${key.replace(/([A-Z])/g, " $1").toLowerCase()} ${checked ? "enabled" : "disabled"}`;toast.success(message);refetch();+ // Prefix match so both string- and number-keyed useGetSite instances update+ queryClient.invalidateQueries({ queryKey: ["get-site"] });} catch (error) {console.error(`Error updating ${key}:`, error);toast.error(`Failed to update ${key.replace(/([A-Z])/g, " $1").toLowerCase()}`);@@ -77,7 +81,7 @@ export function TrackingTab({ siteMetadata, disabled = false }: TrackingTabPropssetLoadingStates(prev => ({ ...prev, [key]: false }));}},- [siteMetadata.siteId, refetch]+ [siteMetadata.siteId, refetch, queryClient]);const { data: subscription, isLoading: isSubscriptionLoading } = useStripeSubscription();