🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Refactor embed functionality and update localization for analytics dashboard
Bill Yangb8e2d5995101
diff --git a/client/messages/cs.json b/client/messages/cs.jsonindex 9ebd92079..41568dec7 100644--- a/client/messages/cs.json+++ b/client/messages/cs.json@@ -24,7 +24,6 @@"M+jZJ6": "Tělo požadavku (JSON)","3gRs+H": "Vyber endpoint pro zobrazení URL požadavku a příkladů kódu","MgdnPi": "Odpověď",- "VVYPEf": "Klikni na \"Provést požadavek\" pro zobrazení odpovědi","jGWq1h": "Časové pásmo","LaV9M1": "Vyber časové pásmo","6RB7ZL": "API Playground",@@ -1181,9 +1180,7 @@"D+v5e+": "","jjBvFh": "","6cBDhe": "",- "3p1aXU": "","rbrahO": "Zavřít",- "V52jNn": "","8pKlHk": "","mhmZ+P": "Přehrávání relací","aRJb8f": "Zaznamenávej a přehrávej uživatelské relace pro pochopení chování uživatelů",@@ -1273,5 +1270,18 @@"QOaR8l": "","IQ5tZg": "","+B+qvw": "",- "vDpLV2": ""+ "vDpLV2": "",+ "/woceI": "",+ "4eYvJG": "",+ "883BVh": "",+ "8jjmwo": "",+ "FsIP28": "",+ "IP4n+n": "",+ "dZAp5K": "",+ "iOrPrD": "",+ "kD8sQL": "",+ "lVP3yI": "",+ "mBCW/X": "",+ "qV0cOR": "",+ "scL+IP": ""}diff --git a/client/messages/de.json b/client/messages/de.jsonindex f5ef6ec60..469d7ba29 100644--- a/client/messages/de.json+++ b/client/messages/de.json@@ -24,7 +24,6 @@"M+jZJ6": "Anfragekörper (JSON)","3gRs+H": "Wählen Sie einen Endpunkt, um die Anfrage-URL und Codebeispiele zu sehen","MgdnPi": "Antwort",- "VVYPEf": "Klicken Sie auf \"Anfrage ausführen\", um die Antwort zu sehen","jGWq1h": "Zeitzone","LaV9M1": "Zeitzone auswählen","6RB7ZL": "API-Spielplatz",@@ -1181,9 +1180,7 @@"D+v5e+": "","jjBvFh": "","6cBDhe": "",- "3p1aXU": "","rbrahO": "Schließen",- "V52jNn": "","8pKlHk": "","mhmZ+P": "Sitzungsaufzeichnung","aRJb8f": "Aufnahme und Wiedergabe von Benutzersitzungen, um das Benutzerverhalten zu verstehen",@@ -1273,5 +1270,18 @@"QOaR8l": "","IQ5tZg": "","+B+qvw": "",- "vDpLV2": ""+ "vDpLV2": "",+ "/woceI": "",+ "4eYvJG": "",+ "883BVh": "",+ "8jjmwo": "",+ "FsIP28": "",+ "IP4n+n": "",+ "dZAp5K": "",+ "iOrPrD": "",+ "kD8sQL": "",+ "lVP3yI": "",+ "mBCW/X": "",+ "qV0cOR": "",+ "scL+IP": ""}diff --git a/client/messages/en.json b/client/messages/en.jsonindex 5f0e51ce9..5d91d1bba 100644--- a/client/messages/en.json+++ b/client/messages/en.json@@ -24,7 +24,6 @@"M+jZJ6": "Request Body (JSON)","3gRs+H": "Select an endpoint to see the request URL and code examples","MgdnPi": "Response",- "VVYPEf": "Click \"Execute Request\" to see the response","jGWq1h": "Time Zone","LaV9M1": "Select timezone","6RB7ZL": "API Playground",@@ -1181,9 +1180,7 @@"D+v5e+": "Tracking","jjBvFh": "Exclusions","6cBDhe": "Integrations",- "3p1aXU": "Embed Widget","rbrahO": "Close",- "V52jNn": "Enabled","8pKlHk": "Enable Embed Widget","mhmZ+P": "Session Replay","aRJb8f": "Record and replay user sessions to understand user behavior",@@ -1273,5 +1270,18 @@"QOaR8l": "Submitted form to \"{action}\"","IQ5tZg": "Submitted form","+B+qvw": "Changed {type}input \"{name}\"",- "vDpLV2": "Changed {type}input"+ "vDpLV2": "Changed {type}input",+ "/woceI": "Embed the public main analytics dashboard on another site.",+ "4eYvJG": "Live Visitor Widget",+ "883BVh": "Failed to update public analytics setting",+ "8jjmwo": "Make this site public to preview",+ "FsIP28": "Hide sidebar",+ "IP4n+n": "Widget Embeds",+ "dZAp5K": "Only the main dashboard page can be viewed from this embed.",+ "iOrPrD": "Public Dashboard",+ "kD8sQL": "Click \"Run\" to see the response",+ "lVP3yI": "No value needed",+ "mBCW/X": "Dashboard Embed",+ "qV0cOR": "Embed a compact live visitor widget on another site.",+ "scL+IP": "Widget Enabled"}diff --git a/client/messages/es.json b/client/messages/es.jsonindex dc72718b3..a7b554edd 100644--- a/client/messages/es.json+++ b/client/messages/es.json@@ -24,7 +24,6 @@"M+jZJ6": "Cuerpo de la solicitud (JSON)","3gRs+H": "Selecciona un endpoint para ver la URL de la solicitud y ejemplos de código","MgdnPi": "Respuesta",- "VVYPEf": "Haz clic en \"Ejecutar solicitud\" para ver la respuesta","jGWq1h": "Zona horaria","LaV9M1": "Seleccionar zona horaria","6RB7ZL": "Playground de API",@@ -1181,9 +1180,7 @@"D+v5e+": "","jjBvFh": "","6cBDhe": "",- "3p1aXU": "","rbrahO": "Cerrar",- "V52jNn": "","8pKlHk": "","mhmZ+P": "Repetición de Sesión","aRJb8f": "Graba y reproduce sesiones de usuarios para entender su comportamiento",@@ -1273,5 +1270,18 @@"QOaR8l": "","IQ5tZg": "","+B+qvw": "",- "vDpLV2": ""+ "vDpLV2": "",+ "/woceI": "",+ "4eYvJG": "",+ "883BVh": "",+ "8jjmwo": "",+ "FsIP28": "",+ "IP4n+n": "",+ "dZAp5K": "",+ "iOrPrD": "",+ "kD8sQL": "",+ "lVP3yI": "",+ "mBCW/X": "",+ "qV0cOR": "",+ "scL+IP": ""}diff --git a/client/messages/fr.json b/client/messages/fr.jsonindex a2e09cd60..aeedfa8d8 100644--- a/client/messages/fr.json+++ b/client/messages/fr.json@@ -24,7 +24,6 @@"M+jZJ6": "Corps de la requête (JSON)","3gRs+H": "Sélectionnez un point d'accès pour voir l'URL de la requête et les exemples de code","MgdnPi": "Réponse",- "VVYPEf": "Cliquez sur \"Exécuter la requête\" pour voir la réponse","jGWq1h": "Fuseau horaire","LaV9M1": "Sélectionner le fuseau horaire","6RB7ZL": "Bac à sable API",@@ -1181,9 +1180,7 @@"D+v5e+": "","jjBvFh": "","6cBDhe": "",- "3p1aXU": "","rbrahO": "Fermer",- "V52jNn": "","8pKlHk": "","mhmZ+P": "Enregistrement de session","aRJb8f": "Enregistrer et rejouer les sessions utilisateur pour comprendre le comportement",@@ -1273,5 +1270,18 @@"QOaR8l": "","IQ5tZg": "","+B+qvw": "",- "vDpLV2": ""+ "vDpLV2": "",+ "/woceI": "",+ "4eYvJG": "",+ "883BVh": "",+ "8jjmwo": "",+ "FsIP28": "",+ "IP4n+n": "",+ "dZAp5K": "",+ "iOrPrD": "",+ "kD8sQL": "",+ "lVP3yI": "",+ "mBCW/X": "",+ "qV0cOR": "",+ "scL+IP": ""}diff --git a/client/messages/it.json b/client/messages/it.jsonindex 58b935adc..96bebeb0c 100644--- a/client/messages/it.json+++ b/client/messages/it.json@@ -24,7 +24,6 @@"M+jZJ6": "Corpo della Richiesta (JSON)","3gRs+H": "Seleziona un endpoint per vedere l'URL della richiesta e gli esempi di codice","MgdnPi": "Risposta",- "VVYPEf": "Clicca \"Esegui Richiesta\" per vedere la risposta","jGWq1h": "Fuso Orario","LaV9M1": "Seleziona fuso orario","6RB7ZL": "API Playground",@@ -1181,9 +1180,7 @@"D+v5e+": "","jjBvFh": "","6cBDhe": "",- "3p1aXU": "","rbrahO": "Chiudi",- "V52jNn": "","8pKlHk": "","mhmZ+P": "Riproduzione Sessione","aRJb8f": "Registra e riproduci le sessioni utente per comprendere il comportamento degli utenti",@@ -1273,5 +1270,18 @@"QOaR8l": "","IQ5tZg": "","+B+qvw": "",- "vDpLV2": ""+ "vDpLV2": "",+ "/woceI": "",+ "4eYvJG": "",+ "883BVh": "",+ "8jjmwo": "",+ "FsIP28": "",+ "IP4n+n": "",+ "dZAp5K": "",+ "iOrPrD": "",+ "kD8sQL": "",+ "lVP3yI": "",+ "mBCW/X": "",+ "qV0cOR": "",+ "scL+IP": ""}diff --git a/client/messages/ja.json b/client/messages/ja.jsonindex b6fb37212..606a09604 100644--- a/client/messages/ja.json+++ b/client/messages/ja.json@@ -24,7 +24,6 @@"M+jZJ6": "リクエストボディ (JSON)","3gRs+H": "エンドポイントを選択してリクエストURLとコード例を確認","MgdnPi": "レスポンス",- "VVYPEf": "「リクエスト実行」をクリックしてレスポンスを確認","jGWq1h": "タイムゾーン","LaV9M1": "タイムゾーンを選択","6RB7ZL": "APIプレイグラウンド",@@ -1181,9 +1180,7 @@"D+v5e+": "","jjBvFh": "","6cBDhe": "",- "3p1aXU": "","rbrahO": "閉じる",- "V52jNn": "","8pKlHk": "","mhmZ+P": "セッションリプレイ","aRJb8f": "ユーザーセッションを記録・再生してユーザー行動を理解",@@ -1273,5 +1270,18 @@"QOaR8l": "","IQ5tZg": "","+B+qvw": "",- "vDpLV2": ""+ "vDpLV2": "",+ "/woceI": "",+ "4eYvJG": "",+ "883BVh": "",+ "8jjmwo": "",+ "FsIP28": "",+ "IP4n+n": "",+ "dZAp5K": "",+ "iOrPrD": "",+ "kD8sQL": "",+ "lVP3yI": "",+ "mBCW/X": "",+ "qV0cOR": "",+ "scL+IP": ""}diff --git a/client/messages/ko.json b/client/messages/ko.jsonindex 41c4689a3..9666b3d0d 100644--- a/client/messages/ko.json+++ b/client/messages/ko.json@@ -24,7 +24,6 @@"M+jZJ6": "요청 본문 (JSON)","3gRs+H": "요청 URL 및 코드 예제를 보려면 엔드포인트를 선택하세요","MgdnPi": "응답",- "VVYPEf": "응답을 보려면 \"요청 실행\"을 클릭하세요","jGWq1h": "시간대","LaV9M1": "시간대 선택","6RB7ZL": "API 플레이그라운드",@@ -1181,9 +1180,7 @@"D+v5e+": "","jjBvFh": "","6cBDhe": "",- "3p1aXU": "","rbrahO": "닫기",- "V52jNn": "","8pKlHk": "","mhmZ+P": "세션 리플레이","aRJb8f": "사용자 행동을 이해하기 위해 사용자 세션을 녹화하고 재생합니다",@@ -1273,5 +1270,18 @@"QOaR8l": "","IQ5tZg": "","+B+qvw": "",- "vDpLV2": ""+ "vDpLV2": "",+ "/woceI": "",+ "4eYvJG": "",+ "883BVh": "",+ "8jjmwo": "",+ "FsIP28": "",+ "IP4n+n": "",+ "dZAp5K": "",+ "iOrPrD": "",+ "kD8sQL": "",+ "lVP3yI": "",+ "mBCW/X": "",+ "qV0cOR": "",+ "scL+IP": ""}diff --git a/client/messages/pl.json b/client/messages/pl.jsonindex c843b21ad..ec1c1a4ef 100644--- a/client/messages/pl.json+++ b/client/messages/pl.json@@ -24,7 +24,6 @@"M+jZJ6": "Treść żądania (JSON)","3gRs+H": "Wybierz endpoint, aby zobaczyć URL żądania i przykłady kodu","MgdnPi": "Odpowiedź",- "VVYPEf": "Kliknij \"Wykonaj żądanie\", aby zobaczyć odpowiedź","jGWq1h": "Strefa czasowa","LaV9M1": "Wybierz strefę czasową","6RB7ZL": "Plac zabaw API",@@ -1181,9 +1180,7 @@"D+v5e+": "","jjBvFh": "","6cBDhe": "",- "3p1aXU": "","rbrahO": "Zamknij",- "V52jNn": "","8pKlHk": "","mhmZ+P": "Odtwarzanie sesji","aRJb8f": "Nagrywaj i odtwarzaj sesje użytkowników, aby zrozumieć ich zachowanie",@@ -1273,5 +1270,18 @@"QOaR8l": "","IQ5tZg": "","+B+qvw": "",- "vDpLV2": ""+ "vDpLV2": "",+ "/woceI": "",+ "4eYvJG": "",+ "883BVh": "",+ "8jjmwo": "",+ "FsIP28": "",+ "IP4n+n": "",+ "dZAp5K": "",+ "iOrPrD": "",+ "kD8sQL": "",+ "lVP3yI": "",+ "mBCW/X": "",+ "qV0cOR": "",+ "scL+IP": ""}diff --git a/client/messages/pt.json b/client/messages/pt.jsonindex 91eeb7a1b..4b18a0ed2 100644--- a/client/messages/pt.json+++ b/client/messages/pt.json@@ -24,7 +24,6 @@"M+jZJ6": "Corpo da Requisição (JSON)","3gRs+H": "Selecione um endpoint para ver a URL da requisição e exemplos de código","MgdnPi": "Resposta",- "VVYPEf": "Clique em \"Executar Requisição\" para ver a resposta","jGWq1h": "Fuso Horário","LaV9M1": "Selecionar fuso horário","6RB7ZL": "Playground da API",@@ -1181,9 +1180,7 @@"D+v5e+": "","jjBvFh": "","6cBDhe": "",- "3p1aXU": "","rbrahO": "Fechar",- "V52jNn": "","8pKlHk": "","mhmZ+P": "Replay de Sessão","aRJb8f": "Grave e reproduza sessões de usuário para entender o comportamento do usuário",@@ -1273,5 +1270,18 @@"QOaR8l": "","IQ5tZg": "","+B+qvw": "",- "vDpLV2": ""+ "vDpLV2": "",+ "/woceI": "",+ "4eYvJG": "",+ "883BVh": "",+ "8jjmwo": "",+ "FsIP28": "",+ "IP4n+n": "",+ "dZAp5K": "",+ "iOrPrD": "",+ "kD8sQL": "",+ "lVP3yI": "",+ "mBCW/X": "",+ "qV0cOR": "",+ "scL+IP": ""}diff --git a/client/messages/uk.json b/client/messages/uk.jsonindex a8606a141..1d976bd91 100644--- a/client/messages/uk.json+++ b/client/messages/uk.json@@ -24,7 +24,6 @@"M+jZJ6": "Тіло запиту (JSON)","3gRs+H": "Виберіть ендпоінт, щоб побачити URL-адресу запиту та приклади коду","MgdnPi": "Відповідь",- "VVYPEf": "Натисніть \"Виконати запит\", щоб побачити відповідь","jGWq1h": "Часовий пояс","LaV9M1": "Виберіть часовий пояс","6RB7ZL": "API Playground",@@ -1181,9 +1180,7 @@"D+v5e+": "","jjBvFh": "","6cBDhe": "",- "3p1aXU": "","rbrahO": "Закрити",- "V52jNn": "","8pKlHk": "","mhmZ+P": "Відтворення сеансів","aRJb8f": "Записуйте та відтворюйте сеанси користувачів, щоб зрозуміти їхню поведінку",@@ -1273,5 +1270,18 @@"QOaR8l": "","IQ5tZg": "","+B+qvw": "",- "vDpLV2": ""+ "vDpLV2": "",+ "/woceI": "",+ "4eYvJG": "",+ "883BVh": "",+ "8jjmwo": "",+ "FsIP28": "",+ "IP4n+n": "",+ "dZAp5K": "",+ "iOrPrD": "",+ "kD8sQL": "",+ "lVP3yI": "",+ "mBCW/X": "",+ "qV0cOR": "",+ "scL+IP": ""}diff --git a/client/messages/zh.json b/client/messages/zh.jsonindex 2f4dd3aff..ca7d64c12 100644--- a/client/messages/zh.json+++ b/client/messages/zh.json@@ -24,7 +24,6 @@"M+jZJ6": "请求体 (JSON)","3gRs+H": "选择一个端点以查看请求 URL 和代码示例","MgdnPi": "响应",- "VVYPEf": "点击“执行请求”以查看响应","jGWq1h": "时区","LaV9M1": "选择时区","6RB7ZL": "API 演练场",@@ -1181,9 +1180,7 @@"D+v5e+": "","jjBvFh": "","6cBDhe": "",- "3p1aXU": "","rbrahO": "关闭",- "V52jNn": "","8pKlHk": "","mhmZ+P": "会话回放","aRJb8f": "记录和回放用户会话以了解用户行为",@@ -1273,5 +1270,18 @@"QOaR8l": "","IQ5tZg": "","+B+qvw": "",- "vDpLV2": ""+ "vDpLV2": "",+ "/woceI": "",+ "4eYvJG": "",+ "883BVh": "",+ "8jjmwo": "",+ "FsIP28": "",+ "IP4n+n": "",+ "dZAp5K": "",+ "iOrPrD": "",+ "kD8sQL": "",+ "lVP3yI": "",+ "mBCW/X": "",+ "qV0cOR": "",+ "scL+IP": ""}diff --git a/client/next.config.ts b/client/next.config.tsindex 1e86abaaa..faa69b5a5 100644--- a/client/next.config.ts+++ b/client/next.config.ts@@ -4,8 +4,8 @@ import createNextIntlPlugin from "next-intl/plugin";const withNextIntl = createNextIntlPlugin({experimental: {srcPath: "./src",- extract: { sourceLocale: "en" },messages: {+ sourceLocale: "en",path: "./messages",format: "json",locales: ["en", "de", "fr", "zh", "es", "pl", "it", "ko", "pt", "ja", "cs", "uk"],diff --git a/client/package-lock.json b/client/package-lock.jsonindex 01715cbe3..f0399fd44 100644--- a/client/package-lock.json+++ b/client/package-lock.json@@ -1443,9 +1443,6 @@"cpu": ["arm64"],- "libc": [- "glibc"- ],"license": "MIT","optional": true,"os": [@@ -1462,9 +1459,6 @@"cpu": ["arm64"],- "libc": [- "musl"- ],"license": "MIT","optional": true,"os": [@@ -1481,9 +1475,6 @@"cpu": ["x64"],- "libc": [- "glibc"- ],"license": "MIT","optional": true,"os": [@@ -1500,9 +1491,6 @@"cpu": ["x64"],- "libc": [- "musl"- ],"license": "MIT","optional": true,"os": [diff --git a/client/scripts/extract-messages.mjs b/client/scripts/extract-messages.mjsindex 1275f820c..0c3a53fd1 100644--- a/client/scripts/extract-messages.mjs+++ b/client/scripts/extract-messages.mjs@@ -6,11 +6,11 @@ const messagesDir = "./messages";await unstable_extractMessages({srcPath: "./src",- sourceLocale: "en",messages: {+ sourceLocale: "en",path: messagesDir,format: "json",- locales: ["en", "de", "fr", "zh", "es", "pl", "it", "ko", "pt", "ja"],+ locales: ["en", "de", "fr", "zh", "es", "pl", "it", "ko", "pt", "ja", "cs", "uk"],},});@@ -21,7 +21,7 @@ for (const file of readdirSync(messagesDir)) {const sorted = Object.fromEntries(Object.keys(data).sort()- .map((k) => [k, data[k]])+ .map(k => [k, data[k]]));writeFileSync(path, JSON.stringify(sorted, null, 2) + "\n");}diff --git a/client/src/app/[site]/components/Sidebar/Sidebar.tsx b/client/src/app/[site]/components/Sidebar/Sidebar.tsxindex af0fd1da6..0ae818a03 100644--- a/client/src/app/[site]/components/Sidebar/Sidebar.tsx+++ b/client/src/app/[site]/components/Sidebar/Sidebar.tsx@@ -23,7 +23,7 @@ import { useGetSite } from "../../../../api/admin/hooks/useSites";import { Sidebar as SidebarComponents } from "../../../../components/sidebar/Sidebar";import { SiteSettings } from "../../../../components/SiteSettings/SiteSettings";import { IS_CLOUD } from "../../../../lib/const";-import { useEmbedablePage } from "../../utils";+import { useEmbedPageOptions } from "../../utils";import { SiteSelector } from "./SiteSelector";import { useStripeSubscription } from "../../../../lib/subscription/useStripeSubscription";@@ -31,10 +31,12 @@ function SidebarContent() {const t = useExtracted();const { data: subscription, isLoading: isSubscriptionLoading } = useStripeSubscription();const pathname = usePathname();- const embed = useEmbedablePage();+ const { embed, hideSidebar } = useEmbedPageOptions();const { data: site } = useGetSite(Number(pathname.split("/")[1]));+ if (hideSidebar) return null;+// Check which tab is active based on the current pathconst getTabPath = (tabName: string) => {const segments = pathname.split("/").filter(Boolean);diff --git a/client/src/app/[site]/layout.tsx b/client/src/app/[site]/layout.tsxindex 7cf40474b..e7293ce33 100644--- a/client/src/app/[site]/layout.tsx+++ b/client/src/app/[site]/layout.tsx@@ -1,6 +1,6 @@"use client";import { useWindowSize } from "@uidotdev/usehooks";-import { usePathname } from "next/navigation";+import { usePathname, useRouter } from "next/navigation";import { useEffect } from "react";import { AppSidebar } from "../../components/AppSidebar";import { useStore } from "../../lib/store";@@ -8,10 +8,31 @@ import { useSyncStateWithUrl } from "../../lib/urlParams";import { Footer } from "../components/Footer";import { Header } from "./components/Header/Header";import { Sidebar } from "./components/Sidebar/Sidebar";+import { useEmbedPageOptions } from "./utils";++const PRIVATE_KEY_PATTERN = /^[a-f0-9]{12}$/i;++function getMainDashboardPath(pathname: string) {+ const segments = pathname.split("/").filter(Boolean);+ const siteId = segments[0];+ if (!siteId || isNaN(Number(siteId))) return null;++ const hasPrivateKey = segments.length > 1 && PRIVATE_KEY_PATTERN.test(segments[1]);+ return hasPrivateKey ? `/${siteId}/${segments[1]}/main` : `/${siteId}/main`;+}++function isMainDashboardPath(pathname: string) {+ const segments = pathname.split("/").filter(Boolean);+ const hasPrivateKey = segments.length > 1 && PRIVATE_KEY_PATTERN.test(segments[1]);+ const route = hasPrivateKey ? segments[2] : segments[1];+ return route === "main";+}export default function SiteLayout({ children }: { children: React.ReactNode }) {const pathname = usePathname();+ const router = useRouter();const { setSite, site, setPrivateKey } = useStore();+ const { hideSidebar } = useEmbedPageOptions();// Sync store state with URL parametersuseSyncStateWithUrl();@@ -36,6 +57,15 @@ export default function SiteLayout({ children }: { children: React.ReactNode })}}, [pathname]);+ useEffect(() => {+ if (!hideSidebar || isMainDashboardPath(pathname)) return;++ const mainPath = getMainDashboardPath(pathname);+ if (!mainPath) return;++ router.replace(`${mainPath}${window.location.search}`);+ }, [hideSidebar, pathname, router]);+const { width } = useWindowSize();if (width && width < 768) {@@ -51,9 +81,11 @@ export default function SiteLayout({ children }: { children: React.ReactNode })<div className="flex flex-row h-dvh"><AppSidebar /><div className="flex flex-1 overflow-hidden">- <div className="hidden md:flex">- <Sidebar />- </div>+ {!hideSidebar && (+ <div className="hidden md:flex">+ <Sidebar />+ </div>+ )}<div className="flex-1 overflow-auto"><div className="min-h-full flex flex-col">{/* <div className="px-4 py-2 max-w-[1400px] mx-auto w-full mb-4"> */}diff --git a/client/src/app/[site]/utils.ts b/client/src/app/[site]/utils.tsindex fd122c169..c2a95ea02 100644--- a/client/src/app/[site]/utils.ts+++ b/client/src/app/[site]/utils.ts@@ -3,14 +3,20 @@import { useQueryState, parseAsBoolean } from "nuqs";import { useCurrentSite } from "../../api/admin/hooks/useSites";-export const useEmbedablePage = () => {+export const useEmbedPageOptions = () => {const [embed] = useQueryState("embed", parseAsBoolean);+ const [hideSidebar] = useQueryState("hideSidebar", parseAsBoolean);const { subscription } = useCurrentSite();- if (embed && subscription?.planName !== "free") {- return true;- }+ const isEmbedPage = !!embed && subscription?.planName !== "free";++ return {+ embed: isEmbedPage,+ hideSidebar: isEmbedPage && !!hideSidebar,+ };+};- return false;+export const useEmbedablePage = () => {+ return useEmbedPageOptions().embed;};diff --git a/client/src/components/SiteSettings/DashboardEmbedTab.tsx b/client/src/components/SiteSettings/DashboardEmbedTab.tsxnew file mode 100644index 000000000..14fc946c1--- /dev/null+++ b/client/src/components/SiteSettings/DashboardEmbedTab.tsx@@ -0,0 +1,143 @@+"use client";++import { useExtracted } from "next-intl";+import { useState } from "react";++import { SiteResponse } from "@/api/admin/endpoints";+import { CodeSnippet } from "@/components/CodeSnippet";+import { Label } from "@/components/ui/label";+import { Switch } from "@/components/ui/switch";++interface DashboardEmbedTabProps {+ siteMetadata: SiteResponse;+ sitePublic: boolean;+ disabled?: boolean;+ togglingPublic: boolean;+ onTogglePublic: (checked: boolean) => void;+}++const DASHBOARD_PREVIEW_WIDTH = 1920;+const DASHBOARD_PREVIEW_HEIGHT = 1080;+const DASHBOARD_PREVIEW_SCALE = 0.3;++export function DashboardEmbedTab({+ siteMetadata,+ sitePublic,+ disabled = false,+ togglingPublic,+ onTogglePublic,+}: DashboardEmbedTabProps) {+ const t = useExtracted();+ const [hideDashboardSidebar, setHideDashboardSidebar] = useState(true);++ const siteId = siteMetadata.siteId;+ const origin = typeof window !== "undefined" ? window.location.origin : "";++ const dashboardUrl = new URL(`${origin}/${siteId}/main`);+ dashboardUrl.searchParams.set("embed", "true");+ if (hideDashboardSidebar) {+ dashboardUrl.searchParams.set("hideSidebar", "true");+ }++ const dashboardPreviewWidth = DASHBOARD_PREVIEW_WIDTH * DASHBOARD_PREVIEW_SCALE;+ const dashboardPreviewHeight = DASHBOARD_PREVIEW_HEIGHT * DASHBOARD_PREVIEW_SCALE;++ const dashboardIframeCode = `<iframe+ src="${dashboardUrl.toString()}"+ style="border: 0; width: 100%; height: 720px;"+ loading="lazy"+ title="Analytics dashboard"+></iframe>`;++ return (+ <div className="space-y-6">+ <div className="flex items-center justify-between gap-4">+ <div>+ <Label htmlFor="dashboard-public" className="text-sm font-medium text-foreground">+ {t("Public Analytics")}+ </Label>+ <p className="text-xs text-muted-foreground mt-1">+ {t("Anyone can view your site analytics without logging in")}+ </p>+ </div>+ <Switch+ id="dashboard-public"+ checked={sitePublic}+ disabled={disabled || togglingPublic}+ onCheckedChange={onTogglePublic}+ />+ </div>++ <section className="space-y-4">+ <div>+ <h5 className="text-xs font-semibold text-foreground uppercase tracking-wide">{t("Public Dashboard")}</h5>+ <p className="text-xs text-muted-foreground mt-1">+ {t("Embed the public main analytics dashboard on another site.")}+ </p>+ </div>++ <fieldset+ disabled={!sitePublic}+ className={`space-y-4 transition-opacity ${!sitePublic ? "opacity-50 pointer-events-none select-none" : ""}`}+ aria-disabled={!sitePublic}+ >+ <div className="flex items-center justify-between gap-4">+ <div>+ <Label htmlFor="dashboard-hide-sidebar" className="text-sm font-medium text-foreground">+ {t("Hide sidebar")}+ </Label>+ <p className="text-xs text-muted-foreground mt-1">+ {t("Only the main dashboard page can be viewed from this embed.")}+ </p>+ </div>+ <Switch+ id="dashboard-hide-sidebar"+ checked={hideDashboardSidebar}+ onCheckedChange={setHideDashboardSidebar}+ />+ </div>+ </fieldset>++ <div className="space-y-2">+ <h5 className="text-xs font-semibold text-foreground uppercase tracking-wide">{t("Preview")}</h5>+ <div className="rounded-md border border-neutral-200 dark:border-neutral-800 p-2 bg-neutral-100 dark:bg-neutral-950">+ {sitePublic ? (+ <div+ className="mx-auto overflow-hidden rounded-sm bg-white dark:bg-neutral-950"+ style={{+ width: dashboardPreviewWidth,+ maxWidth: "100%",+ height: dashboardPreviewHeight,+ }}+ >+ <iframe+ key={dashboardUrl.toString()}+ src={dashboardUrl.toString()}+ width={DASHBOARD_PREVIEW_WIDTH}+ height={DASHBOARD_PREVIEW_HEIGHT}+ style={{+ border: 0,+ width: DASHBOARD_PREVIEW_WIDTH,+ height: DASHBOARD_PREVIEW_HEIGHT,+ transform: `scale(${DASHBOARD_PREVIEW_SCALE})`,+ transformOrigin: "top left",+ }}+ title="Dashboard preview"+ />+ </div>+ ) : (+ <div className="h-[220px] rounded-md border border-dashed border-neutral-300 dark:border-neutral-700 flex items-center justify-center text-xs text-muted-foreground">+ {t("Make this site public to preview")}+ </div>+ )}+ </div>+ </div>++ <div className="space-y-2">+ <h5 className="text-xs font-semibold text-foreground uppercase tracking-wide">{t("Embed Code")}</h5>+ <CodeSnippet language="HTML" code={dashboardIframeCode} />+ </div>+ </section>+ </div>+ );+}diff --git a/client/src/components/SiteSettings/EmbedTab.tsx b/client/src/components/SiteSettings/EmbedTab.tsxindex 60e6d20a0..08ea71296 100644--- a/client/src/components/SiteSettings/EmbedTab.tsx+++ b/client/src/components/SiteSettings/EmbedTab.tsx@@ -17,6 +17,7 @@ interface EmbedTabProps {}const DEFAULT_ACCENT = "#10b981";+type OutputTab = "preview" | "code";function useTimeWindows() {const t = useExtracted();@@ -56,7 +57,7 @@ export function EmbedTab({ siteMetadata, embedEnabled }: EmbedTabProps) {const [width, setWidth] = useState(360);const [theme, setTheme] = useState<"dark" | "light">("dark");const [accent, setAccent] = useState<string>(DEFAULT_ACCENT);- const [outputTab, setOutputTab] = useState<"preview" | "code">("preview");+ const [widgetOutputTab, setWidgetOutputTab] = useState<OutputTab>("preview");const siteId = siteMetadata.siteId;const origin = typeof window !== "undefined" ? window.location.origin : "";@@ -97,9 +98,14 @@ export function EmbedTab({ siteMetadata, embedEnabled }: EmbedTabProps) {></iframe>`;return (- <div className="space-y-6">-- <div className="space-y-2">+ <div className="space-y-4">+ <div className="flex flex-wrap items-start justify-between gap-3">+ <div>+ <h5 className="text-xs font-semibold text-foreground uppercase tracking-wide">{t("Live Visitor Widget")}</h5>+ <p className="text-xs text-muted-foreground mt-1">+ {t("Embed a compact live visitor widget on another site.")}+ </p>+ </div><div className="flex flex-wrap gap-1">{([@@ -110,10 +116,10 @@ export function EmbedTab({ siteMetadata, embedEnabled }: EmbedTabProps) {<buttonkey={tab.key}type="button"- onClick={() => setOutputTab(tab.key)}+ onClick={() => setWidgetOutputTab(tab.key)}className={cn("px-2 py-1 text-xs rounded transition-colors",- outputTab === tab.key+ widgetOutputTab === tab.key? "bg-neutral-100 dark:bg-neutral-700 text-neutral-900 dark:text-neutral-100": "text-neutral-600 dark:text-neutral-400 hover:bg-neutral-50 dark:hover:bg-neutral-800")}@@ -122,40 +128,41 @@ export function EmbedTab({ siteMetadata, embedEnabled }: EmbedTabProps) {</button>))}</div>-- {outputTab === "preview" ? (- <div- className={`rounded-md border border-neutral-200 dark:border-neutral-800 p-4 flex ${variant === "card" ? "justify-center" : "items-center justify-center"- }`}- style={{ background: "#f5f5f5" }}- >- {embedEnabled ? (- <iframe- key={widgetUrl.toString()}- src={widgetUrl.toString()}- style={{- border: 0,- width: iframeWidth,- height,- maxWidth: "100%",- background: "transparent",- }}- title="Widget preview"- />- ) : (- <div- style={{ width: iframeWidth, height, maxWidth: "100%" }}- className="rounded-md border border-dashed border-neutral-300 dark:border-neutral-700 flex items-center justify-center text-xs text-muted-foreground"- >- {t("Enable the embed widget to preview")}- </div>- )}- </div>- ) : (- <CodeSnippet language="HTML" code={iframeCode} />- )}</div>+ {widgetOutputTab === "preview" ? (+ <div+ className={`rounded-md border border-neutral-200 dark:border-neutral-800 p-4 flex ${+ variant === "card" ? "justify-center" : "items-center justify-center"+ }`}+ style={{ background: "#f5f5f5" }}+ >+ {embedEnabled ? (+ <iframe+ key={widgetUrl.toString()}+ src={widgetUrl.toString()}+ style={{+ border: 0,+ width: iframeWidth,+ height,+ maxWidth: "100%",+ background: "transparent",+ }}+ title="Widget preview"+ />+ ) : (+ <div+ style={{ width: iframeWidth, height, maxWidth: "100%" }}+ className="rounded-md border border-dashed border-neutral-300 dark:border-neutral-700 flex items-center justify-center text-xs text-muted-foreground"+ >+ {t("Enable the embed widget to preview")}+ </div>+ )}+ </div>+ ) : (+ <CodeSnippet language="HTML" code={iframeCode} />+ )}+<fieldsetdisabled={!embedEnabled}className={`space-y-6 transition-opacity ${!embedEnabled ? "opacity-50 pointer-events-none select-none" : ""}`}@@ -294,8 +301,6 @@ export function EmbedTab({ siteMetadata, embedEnabled }: EmbedTabProps) {</div></div>)}--</fieldset></div>);diff --git a/client/src/components/SiteSettings/GeneralTab.tsx b/client/src/components/SiteSettings/GeneralTab.tsxindex ab64ea45e..8c1bb6156 100644--- a/client/src/components/SiteSettings/GeneralTab.tsx+++ b/client/src/components/SiteSettings/GeneralTab.tsx@@ -30,6 +30,7 @@ interface GeneralTabProps {siteMetadata: SiteResponse;disabled?: boolean;onClose?: () => void;+ onPublicChange?: (checked: boolean) => void;}interface ToggleConfig {@@ -44,7 +45,7 @@ interface ToggleConfig {badge?: ReactNode;}-export function GeneralTab({ siteMetadata, disabled = false, onClose }: GeneralTabProps) {+export function GeneralTab({ siteMetadata, disabled = false, onClose, onPublicChange }: GeneralTabProps) {const t = useExtracted();const { refetch } = useGetSitesFromOrg(siteMetadata?.organizationId ?? "");const router = useRouter();@@ -74,6 +75,9 @@ export function GeneralTab({ siteMetadata, disabled = false, onClose }: GeneralTtry {await updateSiteConfig(siteMetadata.siteId, { [key]: checked });setToggleStates(prev => ({ ...prev, [key]: checked }));+ if (key === "public") {+ onPublicChange?.(checked);+ }const message = successMessage? checked? successMessage.enabled@@ -89,7 +93,7 @@ export function GeneralTab({ siteMetadata, disabled = false, onClose }: GeneralTsetLoadingStates(prev => ({ ...prev, [key]: false }));}},- [siteMetadata.siteId, refetch]+ [siteMetadata.siteId, refetch, onPublicChange]);const handleNameChange = async () => {diff --git a/client/src/components/SiteSettings/SiteSettings.tsx b/client/src/components/SiteSettings/SiteSettings.tsxindex db21b1066..fd36b7bca 100644--- a/client/src/components/SiteSettings/SiteSettings.tsx+++ b/client/src/components/SiteSettings/SiteSettings.tsx@@ -1,8 +1,18 @@"use client";-import { Ban, Code, Download, LayoutTemplate, Plug, Settings, SlidersHorizontal, X } from "lucide-react";+import {+ Ban,+ Code,+ Download,+ LayoutDashboard,+ LayoutTemplate,+ Plug,+ Settings,+ SlidersHorizontal,+ X,+} from "lucide-react";import { useExtracted } from "next-intl";-import { useCallback, useState } from "react";+import { useCallback, useEffect, useState } from "react";import { Button } from "@/components/ui/button";import { Dialog, DialogClose, DialogContent, DialogTitle, DialogTrigger } from "@/components/ui/dialog";@@ -17,6 +27,7 @@ import { TrackingTab } from "./TrackingTab";import { ExclusionsTab } from "./ExclusionsTab";import { IntegrationsTab } from "./IntegrationsTab";import { EmbedTab } from "./EmbedTab";+import { DashboardEmbedTab } from "./DashboardEmbedTab";import { useGetSite } from "../../api/admin/hooks/useSites";import { useUserOrganizations } from "../../api/admin/hooks/useOrganizations";import { useGetSitesFromOrg } from "../../api/admin/hooks/useSites";@@ -33,7 +44,15 @@ export function SiteSettings({ siteId, trigger }: { siteId: number; trigger?: Rereturn <SiteSettingsInner siteMetadata={siteMetadata} trigger={trigger} />;}-type TabKey = "general" | "tracking" | "exclusions" | "integrations" | "script" | "import" | "embed";+type TabKey =+ | "general"+ | "tracking"+ | "exclusions"+ | "integrations"+ | "script"+ | "import"+ | "widget-embeds"+ | "dashboard-embed";function SiteSettingsInner({ siteMetadata, trigger }: { siteMetadata: SiteResponse; trigger?: React.ReactNode }) {const t = useExtracted();@@ -45,8 +64,15 @@ function SiteSettingsInner({ siteMetadata, trigger }: { siteMetadata: SiteResponconst [activeTab, setActiveTab] = useState<TabKey>("general");const [embedEnabled, setEmbedEnabled] = useState(!!siteMetadata.embedEnabled);const [togglingEmbed, setTogglingEmbed] = useState(false);+ const [sitePublic, setSitePublic] = useState(!!siteMetadata.public);+ const [togglingPublic, setTogglingPublic] = useState(false);const { refetch: refetchOrgSites } = useGetSitesFromOrg(siteMetadata?.organizationId ?? "");+ useEffect(() => {+ setEmbedEnabled(!!siteMetadata.embedEnabled);+ setSitePublic(!!siteMetadata.public);+ }, [siteMetadata.siteId, siteMetadata.embedEnabled, siteMetadata.public]);+const handleToggleEmbed = useCallback(async (checked: boolean) => {setTogglingEmbed(true);@@ -65,17 +91,38 @@ function SiteSettingsInner({ siteMetadata, trigger }: { siteMetadata: SiteRespon[siteMetadata.siteId, refetchOrgSites, t]);+ const handleTogglePublic = useCallback(+ async (checked: boolean) => {+ setTogglingPublic(true);+ try {+ await updateSiteConfig(siteMetadata.siteId, { public: checked });+ setSitePublic(checked);+ toast.success(checked ? t("Site analytics made public") : t("Site analytics made private"));+ refetchOrgSites();+ } catch (error) {+ console.error("Error toggling public analytics:", error);+ toast.error(t("Failed to update public analytics setting"));+ } finally {+ setTogglingPublic(false);+ }+ },+ [siteMetadata.siteId, refetchOrgSites, t]+ );+if (!siteMetadata) {return null;}+ const currentSiteMetadata = { ...siteMetadata, public: sitePublic };+const tabs: { key: TabKey; label: string; icon: React.ComponentType<{ className?: string }>; hidden?: boolean }[] = [{ key: "general", label: t("General"), icon: Settings },{ key: "tracking", label: t("Tracking"), icon: SlidersHorizontal },{ key: "exclusions", label: t("Exclusions"), icon: Ban },{ key: "integrations", label: t("Integrations"), icon: Plug, hidden: !IS_CLOUD },{ key: "script", label: t("Tracking Script"), icon: Code },- { key: "embed", label: t("Embed Widget"), icon: LayoutTemplate },+ { key: "widget-embeds", label: t("Widget Embeds"), icon: LayoutTemplate },+ { key: "dashboard-embed", label: t("Dashboard Embed"), icon: LayoutDashboard },{ key: "import", label: t("Import"), icon: Download },];@@ -125,9 +172,9 @@ function SiteSettingsInner({ siteMetadata, trigger }: { siteMetadata: SiteRespon<main className="flex-1 flex flex-col min-w-0"><header className="px-6 pt-5 pb-3 border-b border-neutral-200 dark:border-neutral-850 flex items-center justify-between gap-4"><DialogTitle className="text-lg font-semibold mb-0">{currentTab.label}</DialogTitle>- {activeTab === "embed" && (+ {activeTab === "widget-embeds" && (<label className="flex items-center gap-2 text-sm text-muted-foreground cursor-pointer">- {t("Enabled")}+ {t("Widget Enabled")}<Switcharia-label={t("Enable Embed Widget")}checked={embedEnabled}@@ -140,18 +187,28 @@ function SiteSettingsInner({ siteMetadata, trigger }: { siteMetadata: SiteRespon<div className="flex-1 overflow-y-auto px-6 py-5">{activeTab === "general" && (<GeneralTab- siteMetadata={siteMetadata}+ siteMetadata={currentSiteMetadata}disabled={disabled}onClose={() => setDialogOpen(false)}+ onPublicChange={setSitePublic}/>)}- {activeTab === "tracking" && <TrackingTab siteMetadata={siteMetadata} disabled={disabled} />}+ {activeTab === "tracking" && <TrackingTab siteMetadata={currentSiteMetadata} disabled={disabled} />}{activeTab === "exclusions" && <ExclusionsTab siteId={siteMetadata.siteId} disabled={disabled} />}{activeTab === "integrations" && IS_CLOUD && <IntegrationsTab disabled={disabled} />}- {activeTab === "script" && (- <ScriptBuilder siteId={siteMetadata.id ?? String(siteMetadata.siteId)} />+ {activeTab === "script" && <ScriptBuilder siteId={siteMetadata.id ?? String(siteMetadata.siteId)} />}+ {activeTab === "widget-embeds" && (+ <EmbedTab siteMetadata={currentSiteMetadata} embedEnabled={embedEnabled} />+ )}+ {activeTab === "dashboard-embed" && (+ <DashboardEmbedTab+ siteMetadata={currentSiteMetadata}+ sitePublic={sitePublic}+ disabled={disabled}+ togglingPublic={togglingPublic}+ onTogglePublic={handleTogglePublic}+ />)}- {activeTab === "embed" && <EmbedTab siteMetadata={siteMetadata} embedEnabled={embedEnabled} />}{activeTab === "import" && <ImportManager siteId={siteMetadata.siteId} disabled={disabled} />}</div></main>diff --git a/client/src/lib/parsers.ts b/client/src/lib/parsers.tsindex 07bdad7dc..7a68a9978 100644--- a/client/src/lib/parsers.ts+++ b/client/src/lib/parsers.ts@@ -119,4 +119,5 @@ export const analyticsParsers = {// Feature flagsembed: parseAsBoolean,+ hideSidebar: parseAsBoolean,};diff --git a/client/src/lib/urlParams.ts b/client/src/lib/urlParams.tsindex e3b9aed0c..7d096592c 100644--- a/client/src/lib/urlParams.ts+++ b/client/src/lib/urlParams.ts@@ -298,7 +298,7 @@ export const useSyncStateWithUrl = () => {}}- // Note: embed param is automatically preserved by nuqs+ // Note: embed params are automatically preserved by nuqssetUrlParams(newParams);// eslint-disable-next-line react-hooks/exhaustive-deps -- intentionally omit pathname to avoid interfering with soft navigation}, [time, bucket, selectedStat, filters, site, setUrlParams, shouldSyncUrl]);diff --git a/docs/content/docs/embed-widget.mdx b/docs/content/docs/embed-widget.mdxindex 5a83a4e9a..a74247776 100644--- a/docs/content/docs/embed-widget.mdx+++ b/docs/content/docs/embed-widget.mdx@@ -1,38 +1,45 @@----title: Embed widget-description: Display a live visitor count on your own site with an embeddable widget+title: Embeds+description: Embed a live visitor widget or public analytics dashboard on your own site---import { Callout } from 'fumadocs-ui/components/callout';import { EmbedWidgetDemo } from '@/components/EmbedWidgetDemo';-The embed widget shows a live visitor count from your Rybbit site on any web page. It's a self-contained iframe — no script tag, no JavaScript on your site, no dependencies.+Rybbit supports two iframe embed options:-## Try it+- **Widget Embeds** show a compact live visitor widget on any web page.+- **Dashboard Embed** shows your public analytics dashboard in an iframe.++Both embeds are self-contained iframes — no script tag, no JavaScript on your site, no dependencies.++## Widget Embeds++### Try itConfigure the widget below to see how it'll look. The preview shows live data from [demo.rybbit.com](https://demo.rybbit.com).<EmbedWidgetDemo />-## Requirements+### Requirements-The widget needs a public read-only data endpoint, so you must enable **Embed Widget** on the site. This is a separate setting from **Public Analytics** — turning it on only exposes the live count, time series, and top countries to the widget endpoint, not your full dashboard.+The widget needs a public read-only data endpoint, so you must enable **Widget Embeds** on the site. This is a separate setting from **Public Analytics** — turning it on only exposes the live count, time series, and top countries to the widget endpoint, not your full dashboard.<Callout type="info">Enabling the embed widget does **not** make your dashboard public. Only the data shown in the widget itself (visitor count, per-minute / per-hour / per-day series, top 5 countries) is accessible — no individual sessions, events, pages, or referrers.</Callout>-## Setup+### Setup1. Open your site in the Rybbit dashboard and click the settings icon.-2. Go to the **Embed Widget** tab.-3. Toggle **Enable Embed Widget** on.+2. Go to the **Widget Embeds** tab.+3. Toggle **Widget Enabled** on.4. Pick your options (variant, time window, theme, accent color).5. Copy the generated `<iframe>` snippet and paste it anywhere on your site.-## Variants+### Variants-### Card+#### CardA self-contained dashboard card showing the live count, an optional bar chart of users over time, and an optional list of top countries.@@ -45,16 +52,16 @@ Options:| Top countries | on / off | on | List the top 5 countries in the window || Width | 240 – 800 px | 360 px | Iframe width; use `max-width: 100%` for responsive sites |-### Inline pill+#### Inline pillA compact pill that fits inline with your site's chrome — e.g. in a header or footer. Shows just the pulsing dot, the live count over the last 30 minutes, and the Rybbit wordmark.-## Appearance+### Appearance- **Theme** — `dark` or `light`. The widget background is transparent, so rounded-corner edges blend into whatever sits behind the iframe.- **Accent color** — pick any hex color. Used for the pulsing live-indicator dot and the bar-chart bars. Defaults to Rybbit emerald.-## Example+### Example```html<iframe@@ -67,7 +74,7 @@ A compact pill that fits inline with your site's chrome — e.g. in a header orIf you self-host Rybbit, replace `app.rybbit.io` with your own domain.-## URL parameters+### URL parametersYou don't usually need to build the URL by hand — the dashboard generates the right snippet for you — but the widget URL accepts:@@ -80,6 +87,48 @@ You don't usually need to build the URL by hand — the dashboard generates the| `chart` | `true`, `false` | Show the bar chart (card variant only) || `countries` | `true`, `false` | Show the top countries (card variant only) |-## Caching+### CachingThe widget HTML and the underlying stats endpoint are both cached for 60 seconds on the server, so embedding the widget on a high-traffic page won't put pressure on your Rybbit instance. The visible count refreshes once per minute.++## Dashboard Embed++The dashboard embed lets you place the main Rybbit analytics dashboard on another site. It uses the normal public dashboard route with `embed=true`.++### Requirements++Dashboard embeds require **Public Analytics** to be enabled for the site. Unlike Widget Embeds, this makes the site's read-only analytics dashboard accessible to anyone with the URL.++<Callout type="warn">+ Only enable Public Analytics if you are comfortable exposing the site's dashboard data publicly.+</Callout>++### Setup++1. Open your site in the Rybbit dashboard and click the settings icon.+2. Go to the **Dashboard Embed** tab.+3. Toggle **Public Analytics** on.+4. Choose whether to hide the dashboard sidebar.+5. Copy the generated `<iframe>` snippet and paste it anywhere on your site.++### Example++```html+<iframe+ src="https://app.rybbit.io/YOUR_SITE_ID/main?embed=true&hideSidebar=true"+ style="border: 0; width: 100%; height: 720px;"+ loading="lazy"+ title="Analytics dashboard"+></iframe>+```++If you self-host Rybbit, replace `app.rybbit.io` with your own domain.++### URL parameters++| Parameter | Values | Description |+| ------------- | --------------- | ---------------------------------------------------------- |+| `embed` | `true` | Enables public embed mode |+| `hideSidebar` | `true`, `false` | Hides the dashboard sidebar and keeps visitors on the main dashboard page |++When `hideSidebar=true`, only the main dashboard page is shown in the iframe. Leave it off if you want viewers to use the dashboard sidebar to navigate other public analytics pages.