Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

fix(tracking): support hashbang routes and opt-in URL fragments (#1300)

Goldflage7629899bd92
diff --git a/client/messages/cs.json b/client/messages/cs.json
index 010c38401..9523a6f3e 100644
--- a/client/messages/cs.json
+++ b/client/messages/cs.json
@@ -243,6 +243,7 @@
"6gHGy0": "Odebrat z organizace",
"6hdNA5": "Události (24h)",
"6kvpmt": "Filtrovat {count} odkazů...",
+ "6mckdQ": "Zachovat fragmenty jako #shipping v cestách pro samostatné sledování kroků objednávky nebo karet",
"6qF/vN": "Obchodní podmínky",
"6rP1gv": "Odhad do konce měsíce",
"6rRDkE": "Limit webů",
@@ -592,6 +593,7 @@
"IZ9nkN": "Vlastníci organizace",
"IZnwKa": "Upravit trychtýř",
"IbhgkP": "Blokování botů zapnuto",
+ "IcxDEZ": "Sledování fragmentů URL vypnuto",
"Il1aAo": "Open source webová analytika od Rybbit",
"IoiMPE": "15 min",
"ItR6u3": "Vyloučené země ({count})",
@@ -1400,6 +1402,7 @@
"kT8vGm": "UTM médium",
"kWMpjI": "Dostupné pro",
"kYpf9a": "Hledat nebo přidat hodnotu",
+ "kZ2fZ0": "Sledování fragmentů URL zapnuto",
"kZki3s": "Získej 50% opakovanou provizi doporučením Rybbit.",
"kehGIT": "Sledování URL parametrů zapnuto",
"kgLyso": "Celkový čas",
@@ -1666,6 +1669,7 @@
"uCk8r+": "Už máš účet?",
"uDXLhQ": "Nebyly vráceny žádné řádky",
"uHJ/7A": "Nainstalujte balíček SDK:",
+ "uHMI7G": "Sledovat fragmenty URL",
"uHnMYi": "Nový segment",
"uMhpKe": "Barva",
"uPDgth": "Hostname",
diff --git a/client/messages/de.json b/client/messages/de.json
index 9a26c78da..69da59a19 100644
--- a/client/messages/de.json
+++ b/client/messages/de.json
@@ -243,6 +243,7 @@
"6gHGy0": "Aus Organisation entfernen",
"6hdNA5": "Ereignisse (24 Std.)",
"6kvpmt": "{count} Links filtern...",
+ "6mckdQ": "Fragmente wie #shipping in Seitenpfaden beibehalten, um Checkout-Schritte oder Tabs getrennt zu erfassen",
"6qF/vN": "Allgemeine Geschäftsbedingungen",
"6rP1gv": "Prognose zum Monatsende",
"6rRDkE": "Website-Limit",
@@ -592,6 +593,7 @@
"IZ9nkN": "Organisationseigentümer",
"IZnwKa": "Trichter bearbeiten",
"IbhgkP": "Bot-Blockierung aktiviert",
+ "IcxDEZ": "Erfassung von URL-Fragmenten deaktiviert",
"Il1aAo": "Open-Source-Webanalyse powered by Rybbit",
"IoiMPE": "15 Min",
"ItR6u3": "Ausgeschlossene Länder ({count})",
@@ -1400,6 +1402,7 @@
"kT8vGm": "UTM-Medium",
"kWMpjI": "Verfügbar für",
"kYpf9a": "Wert suchen oder hinzufügen",
+ "kZ2fZ0": "Erfassung von URL-Fragmenten aktiviert",
"kZki3s": "Verdienen Sie 50% wiederkehrende Provision, indem Sie Rybbit weiterempfehlen.",
"kehGIT": "URL-Parameter-Tracking aktiviert",
"kgLyso": "Gesamtzeit",
@@ -1666,6 +1669,7 @@
"uCk8r+": "Haben Sie bereits ein Konto?",
"uDXLhQ": "Keine Einträge zurückgegeben",
"uHJ/7A": "Installieren Sie das SDK-Paket:",
+ "uHMI7G": "URL-Fragmente erfassen",
"uHnMYi": "Neues Segment",
"uMhpKe": "Farbe",
"uPDgth": "Hostname",
diff --git a/client/messages/en.json b/client/messages/en.json
index 981186a11..1715f149d 100644
--- a/client/messages/en.json
+++ b/client/messages/en.json
@@ -282,6 +282,7 @@
"6gHGy0": "Remove from Organization",
"6hdNA5": "Events (24h)",
"6kvpmt": "Filter {count} links...",
+ "6mckdQ": "Keep fragments such as #shipping in page paths to track checkout stages or tabs separately",
"6pfVZZ": "At this pace you'll reach the limit around {date}.",
"6qF/vN": "Terms and Conditions",
"6rP1gv": "Projected by month end",
@@ -680,6 +681,7 @@
"IZ9nkN": "Organization owners",
"IZnwKa": "Edit Funnel",
"IbhgkP": "Bot blocking enabled",
+ "IcxDEZ": "URL fragment tracking disabled",
"Il1aAo": "Open source web analytics powered by Rybbit",
"IoDlcd": "Slug",
"IoiMPE": "15 Min",
@@ -1605,6 +1607,7 @@
"kT8vGm": "UTM Medium",
"kWMpjI": "Available on",
"kYpf9a": "Search or add value",
+ "kZ2fZ0": "URL fragment tracking enabled",
"kZki3s": "Earn 50% recurring commission by referring Rybbit.",
"kaXNR2": "Lifetime plan from AppSumo.",
"kc9gzx": "Couldn't send the email. Try again in a moment.",
@@ -1905,6 +1908,7 @@
"uDXLhQ": "No rows returned",
"uGFjyJ": "For menus and labels.",
"uHJ/7A": "Install the SDK package:",
+ "uHMI7G": "Track URL fragments",
"uHnMYi": "New segment",
"uK2PEE": "Trial expired",
"uKiVnn": "You'll see the key once, right after you create it.",
diff --git a/client/messages/es.json b/client/messages/es.json
index 7171b1052..34d8e5ee0 100644
--- a/client/messages/es.json
+++ b/client/messages/es.json
@@ -243,6 +243,7 @@
"6gHGy0": "Eliminar de la organización",
"6hdNA5": "Eventos (24h)",
"6kvpmt": "Filtrar {count} enlaces...",
+ "6mckdQ": "Conservar fragmentos como #shipping en las rutas para registrar por separado las etapas de compra o las pestañas",
"6qF/vN": "Términos y condiciones",
"6rP1gv": "Proyección a fin de mes",
"6rRDkE": "Límite de sitios",
@@ -592,6 +593,7 @@
"IZ9nkN": "Propietarios de la organización",
"IZnwKa": "Editar embudo",
"IbhgkP": "Bloqueo de bots activado",
+ "IcxDEZ": "Registro de fragmentos de URL desactivado",
"Il1aAo": "Analíticas web de código abierto impulsadas por Rybbit",
"IoiMPE": "15 min",
"ItR6u3": "Países excluidos ({count})",
@@ -1400,6 +1402,7 @@
"kT8vGm": "Medio UTM",
"kWMpjI": "Disponible en",
"kYpf9a": "Buscar o añadir valor",
+ "kZ2fZ0": "Registro de fragmentos de URL activado",
"kZki3s": "Gana un 50% de comisión recurrente por recomendar Rybbit.",
"kehGIT": "Rastreo de parámetros de URL activado",
"kgLyso": "Tiempo total",
@@ -1666,6 +1669,7 @@
"uCk8r+": "¿Ya tienes una cuenta?",
"uDXLhQ": "No se devolvieron filas",
"uHJ/7A": "Instala el paquete SDK:",
+ "uHMI7G": "Registrar fragmentos de URL",
"uHnMYi": "Nuevo segmento",
"uMhpKe": "Color",
"uPDgth": "Nombre de host",
diff --git a/client/messages/fr.json b/client/messages/fr.json
index 0835553b9..4619cdfdd 100644
--- a/client/messages/fr.json
+++ b/client/messages/fr.json
@@ -243,6 +243,7 @@
"6gHGy0": "Retirer de l'organisation",
"6hdNA5": "Événements (24h)",
"6kvpmt": "Filtrer {count} liens...",
+ "6mckdQ": "Conserver les fragments comme #shipping dans les chemins pour suivre séparément les étapes de commande ou les onglets",
"6qF/vN": "Conditions générales",
"6rP1gv": "Projection en fin de mois",
"6rRDkE": "Limite de sites",
@@ -592,6 +593,7 @@
"IZ9nkN": "Propriétaires de l'organisation",
"IZnwKa": "Modifier l'entonnoir",
"IbhgkP": "Blocage des bots activé",
+ "IcxDEZ": "Suivi des fragments d’URL désactivé",
"Il1aAo": "Analyse web open source propulsée par Rybbit",
"IoiMPE": "15 min",
"ItR6u3": "Pays exclus ({count})",
@@ -1400,6 +1402,7 @@
"kT8vGm": "Support UTM",
"kWMpjI": "Disponible sur",
"kYpf9a": "Rechercher ou ajouter une valeur",
+ "kZ2fZ0": "Suivi des fragments d’URL activé",
"kZki3s": "Gagnez 50% de commission récurrente en recommandant Rybbit.",
"kehGIT": "Suivi des paramètres URL activé",
"kgLyso": "Temps total",
@@ -1666,6 +1669,7 @@
"uCk8r+": "Vous avez déjà un compte ?",
"uDXLhQ": "Aucune ligne retournée",
"uHJ/7A": "Installez le package SDK :",
+ "uHMI7G": "Suivre les fragments d’URL",
"uHnMYi": "Nouveau segment",
"uMhpKe": "Couleur",
"uPDgth": "Nom d'hôte",
diff --git a/client/messages/it.json b/client/messages/it.json
index 86857c57e..32209e90b 100644
--- a/client/messages/it.json
+++ b/client/messages/it.json
@@ -243,6 +243,7 @@
"6gHGy0": "Rimuovi dall'Organizzazione",
"6hdNA5": "Eventi (24h)",
"6kvpmt": "Filtra {count} link...",
+ "6mckdQ": "Mantieni frammenti come #shipping nei percorsi per tracciare separatamente le fasi di acquisto o le schede",
"6qF/vN": "Termini e Condizioni",
"6rP1gv": "Proiezione a fine mese",
"6rRDkE": "Limite siti",
@@ -592,6 +593,7 @@
"IZ9nkN": "Proprietari dell'organizzazione",
"IZnwKa": "Modifica Funnel",
"IbhgkP": "Blocco bot abilitato",
+ "IcxDEZ": "Tracciamento dei frammenti URL disattivato",
"Il1aAo": "Analisi web open source potenziate da Rybbit",
"IoiMPE": "15 min",
"ItR6u3": "Paesi Esclusi ({count})",
@@ -1400,6 +1402,7 @@
"kT8vGm": "Mezzo UTM",
"kWMpjI": "Disponibile su",
"kYpf9a": "Cerca o aggiungi valore",
+ "kZ2fZ0": "Tracciamento dei frammenti URL attivato",
"kZki3s": "Guadagna il 50% di commissioni ricorrenti riferendo Rybbit.",
"kehGIT": "Tracciamento parametri URL abilitato",
"kgLyso": "Tempo Totale",
@@ -1666,6 +1669,7 @@
"uCk8r+": "Hai già un account?",
"uDXLhQ": "Nessuna riga restituita",
"uHJ/7A": "Installa il pacchetto SDK:",
+ "uHMI7G": "Traccia i frammenti URL",
"uHnMYi": "Nuovo segmento",
"uMhpKe": "Colore",
"uPDgth": "Hostname",
diff --git a/client/messages/ja.json b/client/messages/ja.json
index 1702ec574..0f6bc8776 100644
--- a/client/messages/ja.json
+++ b/client/messages/ja.json
@@ -243,6 +243,7 @@
"6gHGy0": "組織から削除",
"6hdNA5": "イベント(24時間)",
"6kvpmt": "{count}件のリンクをフィルター...",
+ "6mckdQ": "ページパスに #shipping などのフラグメントを保持し、購入手続きの段階やタブを個別に追跡します",
"6qF/vN": "利用規約",
"6rP1gv": "月末予測",
"6rRDkE": "ウェブサイト上限",
@@ -592,6 +593,7 @@
"IZ9nkN": "組織オーナー",
"IZnwKa": "ファネルを編集",
"IbhgkP": "ボットブロックを有効にしました",
+ "IcxDEZ": "URL フラグメントの追跡を無効にしました",
"Il1aAo": "Rybbitによるオープンソースウェブアナリティクス",
"IoiMPE": "15分",
"ItR6u3": "除外国({count})",
@@ -1400,6 +1402,7 @@
"kT8vGm": "UTMメディア",
"kWMpjI": "利用可能な範囲",
"kYpf9a": "値を検索または追加",
+ "kZ2fZ0": "URL フラグメントの追跡を有効にしました",
"kZki3s": "Rybbitを紹介して50%の継続報酬を獲得。",
"kehGIT": "URLパラメータ追跡を有効にしました",
"kgLyso": "合計時間",
@@ -1666,6 +1669,7 @@
"uCk8r+": "すでにアカウントをお持ちですか?",
"uDXLhQ": "結果が返されませんでした",
"uHJ/7A": "SDKパッケージをインストールしてください:",
+ "uHMI7G": "URL フラグメントを追跡",
"uHnMYi": "新しいセグメント",
"uMhpKe": "色",
"uPDgth": "ホスト名",
diff --git a/client/messages/ko.json b/client/messages/ko.json
index 7a493372e..07a62f3ff 100644
--- a/client/messages/ko.json
+++ b/client/messages/ko.json
@@ -243,6 +243,7 @@
"6gHGy0": "조직에서 제거",
"6hdNA5": "이벤트 (24시간)",
"6kvpmt": "{count}개 링크 필터...",
+ "6mckdQ": "페이지 경로에 #shipping 같은 프래그먼트를 유지하여 결제 단계나 탭을 개별적으로 추적합니다",
"6qF/vN": "이용약관",
"6rP1gv": "월말 예상치",
"6rRDkE": "웹사이트 제한",
@@ -592,6 +593,7 @@
"IZ9nkN": "조직 소유자",
"IZnwKa": "퍼널 편집",
"IbhgkP": "봇 차단 활성화됨",
+ "IcxDEZ": "URL 프래그먼트 추적 비활성화됨",
"Il1aAo": "Rybbit 기반의 오픈소스 웹 분석",
"IoiMPE": "15분",
"ItR6u3": "제외된 국가 ({count})",
@@ -1400,6 +1402,7 @@
"kT8vGm": "UTM 매체",
"kWMpjI": "적용 범위",
"kYpf9a": "값 검색 또는 추가",
+ "kZ2fZ0": "URL 프래그먼트 추적 활성화됨",
"kZki3s": "Rybbit을 추천하고 50% 반복 수수료를 받으세요.",
"kehGIT": "URL 매개변수 추적 활성화됨",
"kgLyso": "총 시간",
@@ -1666,6 +1669,7 @@
"uCk8r+": "이미 계정이 있으신가요?",
"uDXLhQ": "반환된 행이 없습니다",
"uHJ/7A": "SDK 패키지를 설치하세요:",
+ "uHMI7G": "URL 프래그먼트 추적",
"uHnMYi": "새 세그먼트",
"uMhpKe": "색상",
"uPDgth": "호스트명",
diff --git a/client/messages/pl.json b/client/messages/pl.json
index 6bebb151c..d2c4910ec 100644
--- a/client/messages/pl.json
+++ b/client/messages/pl.json
@@ -243,6 +243,7 @@
"6gHGy0": "Usuń z organizacji",
"6hdNA5": "Zdarzenia (24h)",
"6kvpmt": "Filtruj {count} linków...",
+ "6mckdQ": "Zachowuj fragmenty takie jak #shipping w ścieżkach, aby oddzielnie śledzić etapy zakupu lub karty",
"6qF/vN": "Regulamin",
"6rP1gv": "Prognoza na koniec miesiąca",
"6rRDkE": "Limit witryn",
@@ -592,6 +593,7 @@
"IZ9nkN": "Właściciele organizacji",
"IZnwKa": "Edytuj lejek",
"IbhgkP": "Blokowanie botów włączone",
+ "IcxDEZ": "Śledzenie fragmentów URL wyłączone",
"Il1aAo": "Analityka internetowa open source napędzana przez Rybbit",
"IoiMPE": "15 min",
"ItR6u3": "Wykluczone kraje ({count})",
@@ -1400,6 +1402,7 @@
"kT8vGm": "Medium UTM",
"kWMpjI": "Dostępny w",
"kYpf9a": "Wyszukaj lub dodaj wartość",
+ "kZ2fZ0": "Śledzenie fragmentów URL włączone",
"kZki3s": "Zarabiaj 50% prowizji cyklicznej, polecając Rybbit.",
"kehGIT": "Śledzenie parametrów URL włączone",
"kgLyso": "Łączny czas",
@@ -1666,6 +1669,7 @@
"uCk8r+": "Masz już konto?",
"uDXLhQ": "Brak wyników",
"uHJ/7A": "Zainstaluj pakiet SDK:",
+ "uHMI7G": "Śledź fragmenty URL",
"uHnMYi": "Nowy segment",
"uMhpKe": "Kolor",
"uPDgth": "Nazwa hosta",
diff --git a/client/messages/pt.json b/client/messages/pt.json
index cfc7de5f5..1209b9cdf 100644
--- a/client/messages/pt.json
+++ b/client/messages/pt.json
@@ -243,6 +243,7 @@
"6gHGy0": "Remover da Organização",
"6hdNA5": "Eventos (24h)",
"6kvpmt": "Filtrar {count} links...",
+ "6mckdQ": "Manter fragmentos como #shipping nos caminhos para rastrear separadamente as etapas de compra ou as abas",
"6qF/vN": "Termos e Condições",
"6rP1gv": "Projeção até o fim do mês",
"6rRDkE": "Limite de sites",
@@ -592,6 +593,7 @@
"IZ9nkN": "Proprietários da organização",
"IZnwKa": "Editar Funil",
"IbhgkP": "Bloqueio de bots ativado",
+ "IcxDEZ": "Rastreamento de fragmentos de URL desativado",
"Il1aAo": "Análise web de código aberto desenvolvida por Rybbit",
"IoiMPE": "15 min",
"ItR6u3": "Países Excluídos ({count})",
@@ -1400,6 +1402,7 @@
"kT8vGm": "Mídia UTM",
"kWMpjI": "Disponível em",
"kYpf9a": "Pesquisar ou adicionar valor",
+ "kZ2fZ0": "Rastreamento de fragmentos de URL ativado",
"kZki3s": "Ganhe 50% de comissão recorrente indicando o Rybbit.",
"kehGIT": "Rastreamento de parâmetros de URL ativado",
"kgLyso": "Tempo Total",
@@ -1666,6 +1669,7 @@
"uCk8r+": "Já tem uma conta?",
"uDXLhQ": "Nenhuma linha retornada",
"uHJ/7A": "Instale o pacote SDK:",
+ "uHMI7G": "Rastrear fragmentos de URL",
"uHnMYi": "Novo segmento",
"uMhpKe": "Cor",
"uPDgth": "Hostname",
diff --git a/client/messages/uk.json b/client/messages/uk.json
index 1df71d273..10f02af0b 100644
--- a/client/messages/uk.json
+++ b/client/messages/uk.json
@@ -243,6 +243,7 @@
"6gHGy0": "Видалити з організації",
"6hdNA5": "Події (24 год)",
"6kvpmt": "Фільтрувати {count} посилань...",
+ "6mckdQ": "Зберігати фрагменти на кшталт #shipping у шляхах, щоб окремо відстежувати етапи оформлення замовлення або вкладки",
"6qF/vN": "Умови надання послуг",
"6rP1gv": "Прогноз на кінець місяця",
"6rRDkE": "Ліміт сайтів",
@@ -592,6 +593,7 @@
"IZ9nkN": "Власники організації",
"IZnwKa": "Редагувати воронку",
"IbhgkP": "Блокування ботів увімкнено",
+ "IcxDEZ": "Відстеження фрагментів URL вимкнено",
"Il1aAo": "Вебаналітика з відкритим кодом на базі Rybbit",
"IoiMPE": "15 Мін.",
"ItR6u3": "Виключені країни ({count})",
@@ -1400,6 +1402,7 @@
"kT8vGm": "Канал UTM",
"kWMpjI": "Доступно для",
"kYpf9a": "Пошук або додавання значення",
+ "kZ2fZ0": "Відстеження фрагментів URL увімкнено",
"kZki3s": "Отримуйте 50% регулярної комісії за рекомендацію Rybbit.",
"kehGIT": "Відстеження параметрів URL увімкнено",
"kgLyso": "Загальний час",
@@ -1666,6 +1669,7 @@
"uCk8r+": "Вже є акаунт?",
"uDXLhQ": "Рядків не повернуто",
"uHJ/7A": "Встановіть пакет SDK:",
+ "uHMI7G": "Відстежувати фрагменти URL",
"uHnMYi": "Новий сегмент",
"uMhpKe": "Колір",
"uPDgth": "Ім'я хоста",
diff --git a/client/messages/zh.json b/client/messages/zh.json
index 190f711cf..b816b03d7 100644
--- a/client/messages/zh.json
+++ b/client/messages/zh.json
@@ -243,6 +243,7 @@
"6gHGy0": "从组织中移除",
"6hdNA5": "事件 (24小时)",
"6kvpmt": "过滤 {count} 个链接...",
+ "6mckdQ": "在页面路径中保留 #shipping 等片段,以分别跟踪结账步骤或选项卡",
"6qF/vN": "条款与条件",
"6rP1gv": "月底预估",
"6rRDkE": "网站数量限制",
@@ -592,6 +593,7 @@
"IZ9nkN": "组织所有者",
"IZnwKa": "编辑漏斗",
"IbhgkP": "机器人拦截已启用",
+ "IcxDEZ": "已禁用 URL 片段跟踪",
"Il1aAo": "由 Rybbit 提供支持的开源网络分析",
"IoiMPE": "15 分钟",
"ItR6u3": "已排除的国家/地区 ({count})",
@@ -1400,6 +1402,7 @@
"kT8vGm": "UTM 媒介",
"kWMpjI": "适用范围",
"kYpf9a": "搜索或添加值",
+ "kZ2fZ0": "已启用 URL 片段跟踪",
"kZki3s": "推荐 Rybbit 以赚取 50% 的持续佣金。",
"kehGIT": "URL 参数跟踪已启用",
"kgLyso": "总时长",
@@ -1666,6 +1669,7 @@
"uCk8r+": "已经有账户了?",
"uDXLhQ": "无返回结果",
"uHJ/7A": "安装 SDK 包:",
+ "uHMI7G": "跟踪 URL 片段",
"uHnMYi": "新建分群",
"uMhpKe": "颜色",
"uPDgth": "主机名",
diff --git a/client/src/api/admin/endpoints/sites.ts b/client/src/api/admin/endpoints/sites.ts
index 5ce8e109f..6fd66863b 100644
--- a/client/src/api/admin/endpoints/sites.ts
+++ b/client/src/api/admin/endpoints/sites.ts
@@ -32,6 +32,7 @@ export type SiteResponse = {
trackErrors?: boolean;
trackOutbound?: boolean;
trackUrlParams?: boolean;
+ trackUrlFragments?: boolean;
trackInitialPageView?: boolean;
trackSpaNavigation?: boolean;
trackIp?: boolean;
@@ -105,6 +106,7 @@ export function addSite(
trackErrors?: boolean;
trackOutbound?: boolean;
trackUrlParams?: boolean;
+ trackUrlFragments?: boolean;
trackInitialPageView?: boolean;
trackSpaNavigation?: boolean;
trackButtonClicks?: boolean;
@@ -128,6 +130,7 @@ export function addSite(
trackErrors: settings?.trackErrors,
trackOutbound: settings?.trackOutbound,
trackUrlParams: settings?.trackUrlParams,
+ trackUrlFragments: settings?.trackUrlFragments,
trackInitialPageView: settings?.trackInitialPageView,
trackSpaNavigation: settings?.trackSpaNavigation,
trackButtonClicks: settings?.trackButtonClicks,
@@ -177,6 +180,7 @@ export function updateSiteConfig(
trackErrors?: boolean;
trackOutbound?: boolean;
trackUrlParams?: boolean;
+ trackUrlFragments?: boolean;
trackInitialPageView?: boolean;
trackSpaNavigation?: boolean;
trackIp?: boolean;
diff --git a/client/src/components/SiteSettings/TrackingTab.test.tsx b/client/src/components/SiteSettings/TrackingTab.test.tsx
new file mode 100644
index 000000000..ca8cf5484
--- /dev/null
+++ b/client/src/components/SiteSettings/TrackingTab.test.tsx
@@ -0,0 +1,66 @@
+import React from "react";
+import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import type { SiteResponse } from "@/api/admin/endpoints";
+
+const mocks = vi.hoisted(() => ({
+ updateSiteConfig: vi.fn(),
+ refetch: vi.fn(),
+}));
+
+vi.mock("next-intl", () => ({ useExtracted: () => (message: string) => message }));
+vi.mock("@/api/admin/endpoints", () => ({ updateSiteConfig: mocks.updateSiteConfig }));
+vi.mock("@/api/admin/hooks/useSites", () => ({ useGetSitesFromOrg: () => ({ refetch: mocks.refetch }) }));
+vi.mock("@/lib/subscription/useStripeSubscription", () => ({
+ useStripeSubscription: () => ({ data: { planName: "pro" }, isLoading: false }),
+}));
+vi.mock("@/components/ui/sonner", () => ({ toast: { success: vi.fn(), error: vi.fn() } }));
+
+import { TrackingTab } from "./TrackingTab";
+
+function renderTracking(overrides: Partial<SiteResponse> = {}, disabled = false) {
+ const siteMetadata = { siteId: 17571, type: "web", organizationId: "org_1", ...overrides } as SiteResponse;
+ return render(
+ <QueryClientProvider client={new QueryClient()}>
+ <TrackingTab siteMetadata={siteMetadata} disabled={disabled} />
+ </QueryClientProvider>
+ );
+}
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ mocks.updateSiteConfig.mockResolvedValue({ success: true });
+});
+afterEach(cleanup);
+
+describe("URL fragment tracking setting", () => {
+ it("defaults off and saves the site setting when enabled", async () => {
+ renderTracking();
+ const toggle = screen.getByRole("switch", { name: "Track URL fragments" });
+ expect(toggle.getAttribute("aria-checked")).toBe("false");
+ fireEvent.click(toggle);
+ await waitFor(() => expect(mocks.updateSiteConfig).toHaveBeenCalledWith(17571, { trackUrlFragments: true }));
+ await waitFor(() => expect(toggle.getAttribute("aria-checked")).toBe("true"));
+ expect(mocks.refetch).toHaveBeenCalledOnce();
+ });
+
+ it("shows a saved value and lets the user turn it off", async () => {
+ renderTracking({ trackUrlFragments: true });
+ const toggle = screen.getByRole("switch", { name: "Track URL fragments" });
+ expect(toggle.getAttribute("aria-checked")).toBe("true");
+ fireEvent.click(toggle);
+ await waitFor(() => expect(mocks.updateSiteConfig).toHaveBeenCalledWith(17571, { trackUrlFragments: false }));
+ await waitFor(() => expect(toggle.getAttribute("aria-checked")).toBe("false"));
+ });
+
+ it("respects read-only access", () => {
+ renderTracking({}, true);
+ expect((screen.getByRole("switch", { name: "Track URL fragments" }) as HTMLButtonElement).disabled).toBe(true);
+ });
+
+ it("hides the browser-only setting for mobile sites", () => {
+ renderTracking({ type: "mobile" });
+ expect(screen.queryByRole("switch", { name: "Track URL fragments" })).toBeNull();
+ });
+});
diff --git a/client/src/components/SiteSettings/TrackingTab.tsx b/client/src/components/SiteSettings/TrackingTab.tsx
index b82efd3d5..58005f414 100644
--- a/client/src/components/SiteSettings/TrackingTab.tsx
+++ b/client/src/components/SiteSettings/TrackingTab.tsx
@@ -52,6 +52,7 @@ export function TrackingTab({
trackErrors: siteMetadata.trackErrors || false,
trackOutbound: siteMetadata.trackOutbound ?? true,
trackUrlParams: siteMetadata.trackUrlParams ?? true,
+ trackUrlFragments: siteMetadata.trackUrlFragments ?? false,
trackInitialPageView: siteMetadata.trackInitialPageView ?? true,
trackSpaNavigation: siteMetadata.trackSpaNavigation ?? true,
trackButtonClicks: siteMetadata.trackButtonClicks ?? false,
@@ -162,6 +163,17 @@ export function TrackingTab({
enabledMessage: t("URL parameters tracking enabled"),
disabledMessage: t("URL parameters tracking disabled"),
} as ToggleConfig,
+ {
+ id: "trackUrlFragments",
+ label: t("Track URL fragments"),
+ description: t(
+ "Keep fragments such as #shipping in page paths to track checkout stages or tabs separately"
+ ),
+ value: toggleStates.trackUrlFragments,
+ key: "trackUrlFragments",
+ enabledMessage: t("URL fragment tracking enabled"),
+ disabledMessage: t("URL fragment tracking disabled"),
+ } as ToggleConfig,
]
: []),
{
diff --git a/docs/content/docs/(docs)/script.mdx b/docs/content/docs/(docs)/script.mdx
index b4bc5852e..3f72d4667 100644
--- a/docs/content/docs/(docs)/script.mdx
+++ b/docs/content/docs/(docs)/script.mdx
@@ -68,6 +68,16 @@ Available methods:
See [Feature Flags](/docs/feature-flags) for targeting rules, remote config, and server-side evaluation. */}
+### Hash routes and URL fragments
+
+Rybbit automatically recognizes hash routes beginning with `#/` or `#!/`. For example, `/#/shipping` and `/#!/shipping` are both tracked as `/shipping`.
+
+Ordinary fragments such as `#shipping` are ignored by default. If your site uses them for checkout stages or tabs, enable **Track URL fragments** in your site's **Tracking** settings. Rybbit will then track `/checkout/#shipping` and `/checkout/#payment` as separate paths that you can use in funnels and goals. Enable **SPA Navigation** to automatically record changes between these stages.
+
+Automatic navigation records a pageview only when the tracked path or tracked query string changes. Ignored anchors and repeated navigation events do not add pageviews. Explicit calls to `rybbit.pageview()` still record a pageview for the current URL.
+
+This setting applies to future events; previously discarded fragments cannot be recovered.
+
### Session Replay Attributes
These attributes configure rrweb session replay behavior. They only apply when session replay is enabled in your site settings.
diff --git a/docs/content/docs/(docs)/sdks/web.mdx b/docs/content/docs/(docs)/sdks/web.mdx
index 5f43948f0..6ddb7092f 100644
--- a/docs/content/docs/(docs)/sdks/web.mdx
+++ b/docs/content/docs/(docs)/sdks/web.mdx
@@ -85,6 +85,7 @@ These settings are controlled through your Rybbit dashboard and cannot be set in
| Track Initial Pageview | Track pageview on initial page load | `true` |
| Track SPA Navigation | Track pageviews on Single Page Application route changes | `true` |
| Track URL Parameters | Include URL query strings in tracked data | `true` |
+| Track URL Fragments | Keep ordinary URL fragments, such as `#shipping`, in paths | `false` |
| Track Outbound Links | Automatically track clicks on external links | `true` |
| Track Web Vitals | Track Core Web Vitals performance metrics | `false` |
| Capture Errors | Enable automatic error tracking | `false` |
diff --git a/docs/content/docs/api/sites/get.mdx b/docs/content/docs/api/sites/get.mdx
index b73edb225..80f2dac5b 100644
--- a/docs/content/docs/api/sites/get.mdx
+++ b/docs/content/docs/api/sites/get.mdx
@@ -103,6 +103,10 @@ Returns detailed information about a specific site including its configuration.
description: 'Whether URL parameter tracking is enabled',
type: 'boolean',
},
+ trackUrlFragments: {
+ description: 'Whether ordinary URL fragments are included in tracked paths. Defaults to false.',
+ type: 'boolean',
+ },
}}
/>
diff --git a/docs/content/docs/api/sites/update-config.mdx b/docs/content/docs/api/sites/update-config.mdx
index b694f6e78..8f02663e9 100644
--- a/docs/content/docs/api/sites/update-config.mdx
+++ b/docs/content/docs/api/sites/update-config.mdx
@@ -91,6 +91,11 @@ Updates site configuration settings. All fields are optional - only include the
type: 'boolean',
required: false,
},
+ trackUrlFragments: {
+ description: 'Keep ordinary URL fragments such as #shipping in tracked paths. Disabled by default.',
+ type: 'boolean',
+ required: false,
+ },
}}
/>
diff --git a/server/drizzle/0023_track_url_fragments.sql b/server/drizzle/0023_track_url_fragments.sql
new file mode 100644
index 000000000..c503542d0
--- /dev/null
+++ b/server/drizzle/0023_track_url_fragments.sql
@@ -0,0 +1 @@
+ALTER TABLE "sites" ADD COLUMN IF NOT EXISTS "trackUrlFragments" boolean DEFAULT false;
diff --git a/server/drizzle/meta/0023_snapshot.json b/server/drizzle/meta/0023_snapshot.json
new file mode 100644
index 000000000..493c46484
--- /dev/null
+++ b/server/drizzle/meta/0023_snapshot.json
@@ -0,0 +1,4678 @@
+{
+ "id": "2f39b51e-948e-4b52-acdf-2263643d1583",
+ "prevId": "17d8b70d-d08d-4c77-bf7f-fa0d06ea144b",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "accountId": {
+ "name": "accountId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "providerId": {
+ "name": "providerId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accessToken": {
+ "name": "accessToken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refreshToken": {
+ "name": "refreshToken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "idToken": {
+ "name": "idToken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accessTokenExpiresAt": {
+ "name": "accessTokenExpiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refreshTokenExpiresAt": {
+ "name": "refreshTokenExpiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "account_userId_user_id_fk": {
+ "name": "account_userId_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.active_sessions": {
+ "name": "active_sessions",
+ "schema": "",
+ "columns": {
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_time": {
+ "name": "start_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "last_activity": {
+ "name": "last_activity",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.annotations": {
+ "name": "annotations",
+ "schema": "",
+ "columns": {
+ "annotation_id": {
+ "name": "annotation_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "date": {
+ "name": "date",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_date": {
+ "name": "end_date",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "annotations_site_date_idx": {
+ "name": "annotations_site_date_idx",
+ "columns": [
+ {
+ "expression": "site_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "annotations_org_date_idx": {
+ "name": "annotations_org_date_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "annotations_site_id_sites_site_id_fk": {
+ "name": "annotations_site_id_sites_site_id_fk",
+ "tableFrom": "annotations",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "annotations_organization_id_organization_id_fk": {
+ "name": "annotations_organization_id_organization_id_fk",
+ "tableFrom": "annotations",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "annotations_user_id_user_id_fk": {
+ "name": "annotations_user_id_user_id_fk",
+ "tableFrom": "annotations",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.apikey": {
+ "name": "apikey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start": {
+ "name": "start",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "referenceId": {
+ "name": "referenceId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refillInterval": {
+ "name": "refillInterval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refillAmount": {
+ "name": "refillAmount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lastRefillAt": {
+ "name": "lastRefillAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "rateLimitEnabled": {
+ "name": "rateLimitEnabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "rateLimitTimeWindow": {
+ "name": "rateLimitTimeWindow",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rateLimitMax": {
+ "name": "rateLimitMax",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requestCount": {
+ "name": "requestCount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "remaining": {
+ "name": "remaining",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lastRequest": {
+ "name": "lastRequest",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "configId": {
+ "name": "configId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.cancellation_feedback": {
+ "name": "cancellation_feedback",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reason": {
+ "name": "reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reason_details": {
+ "name": "reason_details",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "retention_offer_shown": {
+ "name": "retention_offer_shown",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "retention_offer_accepted": {
+ "name": "retention_offer_accepted",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "outcome": {
+ "name": "outcome",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plan_name_at_cancellation": {
+ "name": "plan_name_at_cancellation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "monthly_event_count_at_cancellation": {
+ "name": "monthly_event_count_at_cancellation",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.dashboards": {
+ "name": "dashboards",
+ "schema": "",
+ "columns": {
+ "dashboard_id": {
+ "name": "dashboard_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{\"cards\":[]}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "dashboards_site_id_sites_site_id_fk": {
+ "name": "dashboards_site_id_sites_site_id_fk",
+ "tableFrom": "dashboards",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "dashboards_user_id_user_id_fk": {
+ "name": "dashboards_user_id_user_id_fk",
+ "tableFrom": "dashboards",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.experiments": {
+ "name": "experiments",
+ "schema": "",
+ "columns": {
+ "experiment_id": {
+ "name": "experiment_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "feature_flag_id": {
+ "name": "feature_flag_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "primary_goal_id": {
+ "name": "primary_goal_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "hypothesis": {
+ "name": "hypothesis",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'draft'"
+ },
+ "winning_variant": {
+ "name": "winning_variant",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ended_at": {
+ "name": "ended_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "experiments_site_idx": {
+ "name": "experiments_site_idx",
+ "columns": [
+ {
+ "expression": "site_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "experiments_feature_flag_idx": {
+ "name": "experiments_feature_flag_idx",
+ "columns": [
+ {
+ "expression": "feature_flag_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "experiments_primary_goal_idx": {
+ "name": "experiments_primary_goal_idx",
+ "columns": [
+ {
+ "expression": "primary_goal_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "experiments_site_id_sites_site_id_fk": {
+ "name": "experiments_site_id_sites_site_id_fk",
+ "tableFrom": "experiments",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "experiments_feature_flag_id_feature_flags_flag_id_fk": {
+ "name": "experiments_feature_flag_id_feature_flags_flag_id_fk",
+ "tableFrom": "experiments",
+ "tableTo": "feature_flags",
+ "columnsFrom": [
+ "feature_flag_id"
+ ],
+ "columnsTo": [
+ "flag_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "experiments_primary_goal_id_goals_goal_id_fk": {
+ "name": "experiments_primary_goal_id_goals_goal_id_fk",
+ "tableFrom": "experiments",
+ "tableTo": "goals",
+ "columnsFrom": [
+ "primary_goal_id"
+ ],
+ "columnsTo": [
+ "goal_id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "experiments_site_flag_unique": {
+ "name": "experiments_site_flag_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "site_id",
+ "feature_flag_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "experiments_status_check": {
+ "name": "experiments_status_check",
+ "value": "status IN ('draft', 'running', 'paused', 'completed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.feature_flags": {
+ "name": "feature_flags",
+ "schema": "",
+ "columns": {
+ "flag_id": {
+ "name": "flag_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "runtime": {
+ "name": "runtime",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'client'"
+ },
+ "flag_type": {
+ "name": "flag_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'boolean'"
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "variants": {
+ "name": "variants",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "rollout_percentage": {
+ "name": "rollout_percentage",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 100
+ },
+ "rules": {
+ "name": "rules",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "condition_sets": {
+ "name": "condition_sets",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "salt": {
+ "name": "salt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "md5(random()::text || clock_timestamp()::text)"
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "feature_flags_site_idx": {
+ "name": "feature_flags_site_idx",
+ "columns": [
+ {
+ "expression": "site_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "feature_flags_site_id_sites_site_id_fk": {
+ "name": "feature_flags_site_id_sites_site_id_fk",
+ "tableFrom": "feature_flags",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "feature_flags_site_key_unique": {
+ "name": "feature_flags_site_key_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "site_id",
+ "key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "feature_flags_rollout_check": {
+ "name": "feature_flags_rollout_check",
+ "value": "rollout_percentage >= 0 AND rollout_percentage <= 100"
+ },
+ "feature_flags_runtime_check": {
+ "name": "feature_flags_runtime_check",
+ "value": "runtime IN ('client', 'server', 'both')"
+ },
+ "feature_flags_type_check": {
+ "name": "feature_flags_type_check",
+ "value": "flag_type IN ('boolean', 'multivariate', 'remote_config')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.funnels": {
+ "name": "funnels",
+ "schema": "",
+ "columns": {
+ "report_id": {
+ "name": "report_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "data": {
+ "name": "data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "funnels_site_id_sites_site_id_fk": {
+ "name": "funnels_site_id_sites_site_id_fk",
+ "tableFrom": "funnels",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "funnels_user_id_user_id_fk": {
+ "name": "funnels_user_id_user_id_fk",
+ "tableFrom": "funnels",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.goals": {
+ "name": "goals",
+ "schema": "",
+ "columns": {
+ "goal_id": {
+ "name": "goal_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "goal_type": {
+ "name": "goal_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "goals_site_id_sites_site_id_fk": {
+ "name": "goals_site_id_sites_site_id_fk",
+ "tableFrom": "goals",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.gsc_connections": {
+ "name": "gsc_connections",
+ "schema": "",
+ "columns": {
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "gsc_property_url": {
+ "name": "gsc_property_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "gsc_connections_site_id_sites_site_id_fk": {
+ "name": "gsc_connections_site_id_sites_site_id_fk",
+ "tableFrom": "gsc_connections",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.import_status": {
+ "name": "import_status",
+ "schema": "",
+ "columns": {
+ "import_id": {
+ "name": "import_id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "platform": {
+ "name": "platform",
+ "type": "import_platform_enum",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "imported_events": {
+ "name": "imported_events",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "skipped_events": {
+ "name": "skipped_events",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "invalid_events": {
+ "name": "invalid_events",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "import_status_site_id_sites_site_id_fk": {
+ "name": "import_status_site_id_sites_site_id_fk",
+ "tableFrom": "import_status",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "import_status_organization_id_organization_id_fk": {
+ "name": "import_status_organization_id_organization_id_fk",
+ "tableFrom": "import_status",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.invitation": {
+ "name": "invitation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "inviterId": {
+ "name": "inviterId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organizationId": {
+ "name": "organizationId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "has_restricted_site_access": {
+ "name": "has_restricted_site_access",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "site_ids": {
+ "name": "site_ids",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ },
+ "site_role": {
+ "name": "site_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "teamId": {
+ "name": "teamId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "invitation_inviterId_user_id_fk": {
+ "name": "invitation_inviterId_user_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "user",
+ "columnsFrom": [
+ "inviterId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "invitation_organizationId_organization_id_fk": {
+ "name": "invitation_organizationId_organization_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organizationId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "invitation_teamId_team_id_fk": {
+ "name": "invitation_teamId_team_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "team",
+ "columnsFrom": [
+ "teamId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.jwks": {
+ "name": "jwks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "publicKey": {
+ "name": "publicKey",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "privateKey": {
+ "name": "privateKey",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "alg": {
+ "name": "alg",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "crv": {
+ "name": "crv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.lifecycle_email_log": {
+ "name": "lifecycle_email_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_key": {
+ "name": "email_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "lifecycle_email_log_user_id_user_id_fk": {
+ "name": "lifecycle_email_log_user_id_user_id_fk",
+ "tableFrom": "lifecycle_email_log",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "lifecycle_email_log_user_email_key_unique": {
+ "name": "lifecycle_email_log_user_email_key_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id",
+ "email_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.member": {
+ "name": "member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organizationId": {
+ "name": "organizationId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "has_restricted_site_access": {
+ "name": "has_restricted_site_access",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "member_organizationId_organization_id_fk": {
+ "name": "member_organizationId_organization_id_fk",
+ "tableFrom": "member",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organizationId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "member_userId_user_id_fk": {
+ "name": "member_userId_user_id_fk",
+ "tableFrom": "member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.member_site_access": {
+ "name": "member_site_access",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "member_id": {
+ "name": "member_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "member_site_access_member_idx": {
+ "name": "member_site_access_member_idx",
+ "columns": [
+ {
+ "expression": "member_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "member_site_access_site_idx": {
+ "name": "member_site_access_site_idx",
+ "columns": [
+ {
+ "expression": "site_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "member_site_access_member_id_member_id_fk": {
+ "name": "member_site_access_member_id_member_id_fk",
+ "tableFrom": "member_site_access",
+ "tableTo": "member",
+ "columnsFrom": [
+ "member_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "member_site_access_site_id_sites_site_id_fk": {
+ "name": "member_site_access_site_id_sites_site_id_fk",
+ "tableFrom": "member_site_access",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "member_site_access_created_by_user_id_fk": {
+ "name": "member_site_access_created_by_user_id_fk",
+ "tableFrom": "member_site_access",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "member_site_access_unique": {
+ "name": "member_site_access_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "member_id",
+ "site_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauthAccessToken": {
+ "name": "oauthAccessToken",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "accessToken": {
+ "name": "accessToken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refreshToken": {
+ "name": "refreshToken",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accessTokenExpiresAt": {
+ "name": "accessTokenExpiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refreshTokenExpiresAt": {
+ "name": "refreshTokenExpiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "clientId": {
+ "name": "clientId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "oauthAccessToken_clientId_oauthApplication_clientId_fk": {
+ "name": "oauthAccessToken_clientId_oauthApplication_clientId_fk",
+ "tableFrom": "oauthAccessToken",
+ "tableTo": "oauthApplication",
+ "columnsFrom": [
+ "clientId"
+ ],
+ "columnsTo": [
+ "clientId"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauthAccessToken_userId_user_id_fk": {
+ "name": "oauthAccessToken_userId_user_id_fk",
+ "tableFrom": "oauthAccessToken",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauthAccessToken_accessToken_unique": {
+ "name": "oauthAccessToken_accessToken_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "accessToken"
+ ]
+ },
+ "oauthAccessToken_refreshToken_unique": {
+ "name": "oauthAccessToken_refreshToken_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "refreshToken"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauthAccessTokenV2": {
+ "name": "oauthAccessTokenV2",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "clientId": {
+ "name": "clientId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sessionId": {
+ "name": "sessionId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "referenceId": {
+ "name": "referenceId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authorizationCodeId": {
+ "name": "authorizationCodeId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resources": {
+ "name": "resources",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requestedUserInfoClaims": {
+ "name": "requestedUserInfoClaims",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refreshId": {
+ "name": "refreshId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revoked": {
+ "name": "revoked",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "confirmation": {
+ "name": "confirmation",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauthAccessTokenV2_clientId_idx": {
+ "name": "oauthAccessTokenV2_clientId_idx",
+ "columns": [
+ {
+ "expression": "clientId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessTokenV2_sessionId_idx": {
+ "name": "oauthAccessTokenV2_sessionId_idx",
+ "columns": [
+ {
+ "expression": "sessionId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessTokenV2_userId_idx": {
+ "name": "oauthAccessTokenV2_userId_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessTokenV2_authorizationCodeId_idx": {
+ "name": "oauthAccessTokenV2_authorizationCodeId_idx",
+ "columns": [
+ {
+ "expression": "authorizationCodeId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessTokenV2_refreshId_idx": {
+ "name": "oauthAccessTokenV2_refreshId_idx",
+ "columns": [
+ {
+ "expression": "refreshId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauthAccessTokenV2_clientId_oauthClient_clientId_fk": {
+ "name": "oauthAccessTokenV2_clientId_oauthClient_clientId_fk",
+ "tableFrom": "oauthAccessTokenV2",
+ "tableTo": "oauthClient",
+ "columnsFrom": [
+ "clientId"
+ ],
+ "columnsTo": [
+ "clientId"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauthAccessTokenV2_sessionId_session_id_fk": {
+ "name": "oauthAccessTokenV2_sessionId_session_id_fk",
+ "tableFrom": "oauthAccessTokenV2",
+ "tableTo": "session",
+ "columnsFrom": [
+ "sessionId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "oauthAccessTokenV2_userId_user_id_fk": {
+ "name": "oauthAccessTokenV2_userId_user_id_fk",
+ "tableFrom": "oauthAccessTokenV2",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauthAccessTokenV2_refreshId_oauthRefreshToken_id_fk": {
+ "name": "oauthAccessTokenV2_refreshId_oauthRefreshToken_id_fk",
+ "tableFrom": "oauthAccessTokenV2",
+ "tableTo": "oauthRefreshToken",
+ "columnsFrom": [
+ "refreshId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauthAccessTokenV2_token_unique": {
+ "name": "oauthAccessTokenV2_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauthApplication": {
+ "name": "oauthApplication",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "clientId": {
+ "name": "clientId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "clientSecret": {
+ "name": "clientSecret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "redirectUrls": {
+ "name": "redirectUrls",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "disabled": {
+ "name": "disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "oauthApplication_userId_user_id_fk": {
+ "name": "oauthApplication_userId_user_id_fk",
+ "tableFrom": "oauthApplication",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauthApplication_clientId_unique": {
+ "name": "oauthApplication_clientId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "clientId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauthClient": {
+ "name": "oauthClient",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "clientId": {
+ "name": "clientId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "clientSecret": {
+ "name": "clientSecret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "clientDiscoveryId": {
+ "name": "clientDiscoveryId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disabled": {
+ "name": "disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "skipConsent": {
+ "name": "skipConsent",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enableEndSession": {
+ "name": "enableEndSession",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subjectType": {
+ "name": "subjectType",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "clientCredentialsScopes": {
+ "name": "clientCredentialsScopes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uri": {
+ "name": "uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contacts": {
+ "name": "contacts",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tos": {
+ "name": "tos",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policy": {
+ "name": "policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "softwareId": {
+ "name": "softwareId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "softwareVersion": {
+ "name": "softwareVersion",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "softwareStatement": {
+ "name": "softwareStatement",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "redirectUris": {
+ "name": "redirectUris",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "postLogoutRedirectUris": {
+ "name": "postLogoutRedirectUris",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backchannelLogoutUri": {
+ "name": "backchannelLogoutUri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backchannelLogoutSessionRequired": {
+ "name": "backchannelLogoutSessionRequired",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tokenEndpointAuthMethod": {
+ "name": "tokenEndpointAuthMethod",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "applicationType": {
+ "name": "applicationType",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "jwks": {
+ "name": "jwks",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "jwksUri": {
+ "name": "jwksUri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "grantTypes": {
+ "name": "grantTypes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responseTypes": {
+ "name": "responseTypes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requirePKCE": {
+ "name": "requirePKCE",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dpopBoundAccessTokens": {
+ "name": "dpopBoundAccessTokens",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "referenceId": {
+ "name": "referenceId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "oauthClient_userId_idx": {
+ "name": "oauthClient_userId_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauthClient_userId_user_id_fk": {
+ "name": "oauthClient_userId_user_id_fk",
+ "tableFrom": "oauthClient",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauthClient_clientId_unique": {
+ "name": "oauthClient_clientId_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "clientId"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauthClientAssertion": {
+ "name": "oauthClientAssertion",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauthClientResource": {
+ "name": "oauthClientResource",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "clientId": {
+ "name": "clientId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resourceId": {
+ "name": "resourceId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "oauthClientResource_clientId_resourceId_uidx": {
+ "name": "oauthClientResource_clientId_resourceId_uidx",
+ "columns": [
+ {
+ "expression": "clientId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resourceId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthClientResource_clientId_idx": {
+ "name": "oauthClientResource_clientId_idx",
+ "columns": [
+ {
+ "expression": "clientId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthClientResource_resourceId_idx": {
+ "name": "oauthClientResource_resourceId_idx",
+ "columns": [
+ {
+ "expression": "resourceId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauthClientResource_clientId_oauthClient_clientId_fk": {
+ "name": "oauthClientResource_clientId_oauthClient_clientId_fk",
+ "tableFrom": "oauthClientResource",
+ "tableTo": "oauthClient",
+ "columnsFrom": [
+ "clientId"
+ ],
+ "columnsTo": [
+ "clientId"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauthClientResource_resourceId_oauthResource_identifier_fk": {
+ "name": "oauthClientResource_resourceId_oauthResource_identifier_fk",
+ "tableFrom": "oauthClientResource",
+ "tableTo": "oauthResource",
+ "columnsFrom": [
+ "resourceId"
+ ],
+ "columnsTo": [
+ "identifier"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauthConsent": {
+ "name": "oauthConsent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "clientId": {
+ "name": "clientId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "consentGiven": {
+ "name": "consentGiven",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "oauthConsent_clientId_oauthApplication_clientId_fk": {
+ "name": "oauthConsent_clientId_oauthApplication_clientId_fk",
+ "tableFrom": "oauthConsent",
+ "tableTo": "oauthApplication",
+ "columnsFrom": [
+ "clientId"
+ ],
+ "columnsTo": [
+ "clientId"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauthConsent_userId_user_id_fk": {
+ "name": "oauthConsent_userId_user_id_fk",
+ "tableFrom": "oauthConsent",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauthConsentV2": {
+ "name": "oauthConsentV2",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "clientId": {
+ "name": "clientId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "referenceId": {
+ "name": "referenceId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resources": {
+ "name": "resources",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requestedUserInfoClaims": {
+ "name": "requestedUserInfoClaims",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauthConsentV2_clientId_idx": {
+ "name": "oauthConsentV2_clientId_idx",
+ "columns": [
+ {
+ "expression": "clientId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthConsentV2_userId_idx": {
+ "name": "oauthConsentV2_userId_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauthConsentV2_clientId_oauthClient_clientId_fk": {
+ "name": "oauthConsentV2_clientId_oauthClient_clientId_fk",
+ "tableFrom": "oauthConsentV2",
+ "tableTo": "oauthClient",
+ "columnsFrom": [
+ "clientId"
+ ],
+ "columnsTo": [
+ "clientId"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauthConsentV2_userId_user_id_fk": {
+ "name": "oauthConsentV2_userId_user_id_fk",
+ "tableFrom": "oauthConsentV2",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauthRefreshToken": {
+ "name": "oauthRefreshToken",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "clientId": {
+ "name": "clientId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sessionId": {
+ "name": "sessionId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "referenceId": {
+ "name": "referenceId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authorizationCodeId": {
+ "name": "authorizationCodeId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resources": {
+ "name": "resources",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requestedUserInfoClaims": {
+ "name": "requestedUserInfoClaims",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revoked": {
+ "name": "revoked",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rotatedAt": {
+ "name": "rotatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rotationReplayResponse": {
+ "name": "rotationReplayResponse",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rotationReplayExpiresAt": {
+ "name": "rotationReplayExpiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authTime": {
+ "name": "authTime",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "confirmation": {
+ "name": "confirmation",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauthRefreshToken_clientId_idx": {
+ "name": "oauthRefreshToken_clientId_idx",
+ "columns": [
+ {
+ "expression": "clientId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthRefreshToken_sessionId_idx": {
+ "name": "oauthRefreshToken_sessionId_idx",
+ "columns": [
+ {
+ "expression": "sessionId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthRefreshToken_userId_idx": {
+ "name": "oauthRefreshToken_userId_idx",
+ "columns": [
+ {
+ "expression": "userId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthRefreshToken_authorizationCodeId_idx": {
+ "name": "oauthRefreshToken_authorizationCodeId_idx",
+ "columns": [
+ {
+ "expression": "authorizationCodeId",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauthRefreshToken_clientId_oauthClient_clientId_fk": {
+ "name": "oauthRefreshToken_clientId_oauthClient_clientId_fk",
+ "tableFrom": "oauthRefreshToken",
+ "tableTo": "oauthClient",
+ "columnsFrom": [
+ "clientId"
+ ],
+ "columnsTo": [
+ "clientId"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauthRefreshToken_sessionId_session_id_fk": {
+ "name": "oauthRefreshToken_sessionId_session_id_fk",
+ "tableFrom": "oauthRefreshToken",
+ "tableTo": "session",
+ "columnsFrom": [
+ "sessionId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "oauthRefreshToken_userId_user_id_fk": {
+ "name": "oauthRefreshToken_userId_user_id_fk",
+ "tableFrom": "oauthRefreshToken",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauthRefreshToken_token_unique": {
+ "name": "oauthRefreshToken_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauthResource": {
+ "name": "oauthResource",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "accessTokenTtl": {
+ "name": "accessTokenTtl",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refreshTokenTtl": {
+ "name": "refreshTokenTtl",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signingAlgorithm": {
+ "name": "signingAlgorithm",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signingKeyId": {
+ "name": "signingKeyId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "allowedScopes": {
+ "name": "allowedScopes",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "customClaims": {
+ "name": "customClaims",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dpopBoundAccessTokensRequired": {
+ "name": "dpopBoundAccessTokensRequired",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "disabled": {
+ "name": "disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policyVersion": {
+ "name": "policyVersion",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauthResource_identifier_unique": {
+ "name": "oauthResource_identifier_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "identifier"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization": {
+ "name": "organization",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripeCustomerId": {
+ "name": "stripeCustomerId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "monthlyEventCount": {
+ "name": "monthlyEventCount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "overMonthlyLimit": {
+ "name": "overMonthlyLimit",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "approachingLimitNotifiedPeriodStart": {
+ "name": "approachingLimitNotifiedPeriodStart",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "planOverride": {
+ "name": "planOverride",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "custom_plan": {
+ "name": "custom_plan",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "organization_slug_unique": {
+ "name": "organization_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.segments": {
+ "name": "segments",
+ "schema": "",
+ "columns": {
+ "segment_id": {
+ "name": "segment_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "filters": {
+ "name": "filters",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'segment'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "segments_organization_idx": {
+ "name": "segments_organization_idx",
+ "columns": [
+ {
+ "expression": "organization_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "segments_site_idx": {
+ "name": "segments_site_idx",
+ "columns": [
+ {
+ "expression": "site_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "segments_organization_id_organization_id_fk": {
+ "name": "segments_organization_id_organization_id_fk",
+ "tableFrom": "segments",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "segments_site_id_sites_site_id_fk": {
+ "name": "segments_site_id_sites_site_id_fk",
+ "tableFrom": "segments",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "segments_user_id_user_id_fk": {
+ "name": "segments_user_id_user_id_fk",
+ "tableFrom": "segments",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ipAddress": {
+ "name": "ipAddress",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "userAgent": {
+ "name": "userAgent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "impersonatedBy": {
+ "name": "impersonatedBy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "activeOrganizationId": {
+ "name": "activeOrganizationId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "activeTeamId": {
+ "name": "activeTeamId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "session_userId_user_id_fk": {
+ "name": "session_userId_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.site_transfers": {
+ "name": "site_transfers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_organization_id": {
+ "name": "source_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recipient_email": {
+ "name": "recipient_email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "site_transfers_site_id_sites_site_id_fk": {
+ "name": "site_transfers_site_id_sites_site_id_fk",
+ "tableFrom": "site_transfers",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "site_transfers_source_organization_id_organization_id_fk": {
+ "name": "site_transfers_source_organization_id_organization_id_fk",
+ "tableFrom": "site_transfers",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "source_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "site_transfers_created_by_user_id_fk": {
+ "name": "site_transfers_created_by_user_id_fk",
+ "tableFrom": "site_transfers",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "site_transfers_site_unique": {
+ "name": "site_transfers_site_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "site_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.sites": {
+ "name": "sites",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "domain": {
+ "name": "domain",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "public": {
+ "name": "public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "embed_enabled": {
+ "name": "embed_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "saltUserIds": {
+ "name": "saltUserIds",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "blockBots": {
+ "name": "blockBots",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "first_party_proxy": {
+ "name": "first_party_proxy",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "excluded_ips": {
+ "name": "excluded_ips",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ },
+ "excluded_countries": {
+ "name": "excluded_countries",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ },
+ "excluded_paths": {
+ "name": "excluded_paths",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ },
+ "excluded_hostnames": {
+ "name": "excluded_hostnames",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ },
+ "excluded_user_agents": {
+ "name": "excluded_user_agents",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ },
+ "excluded_asns": {
+ "name": "excluded_asns",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ },
+ "excluded_query_params": {
+ "name": "excluded_query_params",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ },
+ "sessionReplay": {
+ "name": "sessionReplay",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "webVitals": {
+ "name": "webVitals",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "trackErrors": {
+ "name": "trackErrors",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "trackOutbound": {
+ "name": "trackOutbound",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "trackUrlParams": {
+ "name": "trackUrlParams",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "trackInitialPageView": {
+ "name": "trackInitialPageView",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "trackSpaNavigation": {
+ "name": "trackSpaNavigation",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "trackIp": {
+ "name": "trackIp",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "trackButtonClicks": {
+ "name": "trackButtonClicks",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "trackCopy": {
+ "name": "trackCopy",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "trackFormInteractions": {
+ "name": "trackFormInteractions",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "api_key": {
+ "name": "api_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "private_link_key": {
+ "name": "private_link_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tags": {
+ "name": "tags",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ },
+ "detected_platform": {
+ "name": "detected_platform",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claim_expires_at": {
+ "name": "claim_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trackUrlFragments": {
+ "name": "trackUrlFragments",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "sites_created_by_user_id_fk": {
+ "name": "sites_created_by_user_id_fk",
+ "tableFrom": "sites",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "sites_organization_id_organization_id_fk": {
+ "name": "sites_organization_id_organization_id_fk",
+ "tableFrom": "sites",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "sites_type_check": {
+ "name": "sites_type_check",
+ "value": "\"sites\".\"type\" IS NULL OR \"sites\".\"type\" IN ('web', 'mobile')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.team": {
+ "name": "team",
+ "schema": "",
+ "columns": {
+ "memberCount": {
+ "name": "memberCount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organizationId": {
+ "name": "organizationId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "team_organizationId_organization_id_fk": {
+ "name": "team_organizationId_organization_id_fk",
+ "tableFrom": "team",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organizationId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.teamMember": {
+ "name": "teamMember",
+ "schema": "",
+ "columns": {
+ "membershipKey": {
+ "name": "membershipKey",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "teamId": {
+ "name": "teamId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "teamMember_teamId_team_id_fk": {
+ "name": "teamMember_teamId_team_id_fk",
+ "tableFrom": "teamMember",
+ "tableTo": "team",
+ "columnsFrom": [
+ "teamId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "teamMember_userId_user_id_fk": {
+ "name": "teamMember_userId_user_id_fk",
+ "tableFrom": "teamMember",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "teamMember_membershipKey_unique": {
+ "name": "teamMember_membershipKey_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "membershipKey"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team_site_access": {
+ "name": "team_site_access",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "team_site_access_team_idx": {
+ "name": "team_site_access_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_site_access_site_idx": {
+ "name": "team_site_access_site_idx",
+ "columns": [
+ {
+ "expression": "site_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_site_access_team_id_team_id_fk": {
+ "name": "team_site_access_team_id_team_id_fk",
+ "tableFrom": "team_site_access",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_site_access_site_id_sites_site_id_fk": {
+ "name": "team_site_access_site_id_sites_site_id_fk",
+ "tableFrom": "team_site_access",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "team_site_access_unique": {
+ "name": "team_site_access_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "team_id",
+ "site_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.telemetry": {
+ "name": "telemetry",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "instance_id": {
+ "name": "instance_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "version": {
+ "name": "version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "table_counts": {
+ "name": "table_counts",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "clickhouse_size_gb": {
+ "name": "clickhouse_size_gb",
+ "type": "real",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "emailVerified": {
+ "name": "emailVerified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'user'"
+ },
+ "displayUsername": {
+ "name": "displayUsername",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "banned": {
+ "name": "banned",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "banReason": {
+ "name": "banReason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "banExpires": {
+ "name": "banExpires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "stripeCustomerId": {
+ "name": "stripeCustomerId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "overMonthlyLimit": {
+ "name": "overMonthlyLimit",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "monthlyEventCount": {
+ "name": "monthlyEventCount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "sendAutoEmailReports": {
+ "name": "sendAutoEmailReports",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "scheduled_tip_email_ids": {
+ "name": "scheduled_tip_email_ids",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_username_unique": {
+ "name": "user_username_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "username"
+ ]
+ },
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_aliases": {
+ "name": "user_aliases",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "anonymous_id": {
+ "name": "anonymous_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_aliases_user_idx": {
+ "name": "user_aliases_user_idx",
+ "columns": [
+ {
+ "expression": "site_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_aliases_anon_idx": {
+ "name": "user_aliases_anon_idx",
+ "columns": [
+ {
+ "expression": "site_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "anonymous_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_aliases_site_id_sites_site_id_fk": {
+ "name": "user_aliases_site_id_sites_site_id_fk",
+ "tableFrom": "user_aliases",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_aliases_site_anon_unique": {
+ "name": "user_aliases_site_anon_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "site_id",
+ "anonymous_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_profiles": {
+ "name": "user_profiles",
+ "schema": "",
+ "columns": {
+ "site_id": {
+ "name": "site_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "traits": {
+ "name": "traits",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_profiles_site_idx": {
+ "name": "user_profiles_site_idx",
+ "columns": [
+ {
+ "expression": "site_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_profiles_site_id_sites_site_id_fk": {
+ "name": "user_profiles_site_id_sites_site_id_fk",
+ "tableFrom": "user_profiles",
+ "tableTo": "sites",
+ "columnsFrom": [
+ "site_id"
+ ],
+ "columnsTo": [
+ "site_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "user_profiles_site_id_user_id_pk": {
+ "name": "user_profiles_site_id_user_id_pk",
+ "columns": [
+ "site_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expiresAt": {
+ "name": "expiresAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "createdAt": {
+ "name": "createdAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updatedAt": {
+ "name": "updatedAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {
+ "public.import_platform_enum": {
+ "name": "import_platform_enum",
+ "schema": "public",
+ "values": [
+ "umami",
+ "simple_analytics",
+ "plausible"
+ ]
+ }
+ },
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/server/drizzle/meta/_journal.json b/server/drizzle/meta/_journal.json
index adfcc377c..6304c8f2f 100644
--- a/server/drizzle/meta/_journal.json
+++ b/server/drizzle/meta/_journal.json
@@ -162,6 +162,13 @@
"when": 1790741724744,
"tag": "0022_site_transfers",
"breakpoints": true
+ },
+ {
+ "idx": 23,
+ "version": "7",
+ "when": 1791346537258,
+ "tag": "0023_track_url_fragments",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/server/public/script-full.js b/server/public/script-full.js
index 8dfed6437..3447a8ca1 100644
--- a/server/public/script-full.js
+++ b/server/public/script-full.js
@@ -66,6 +66,17 @@
}
}
+ // url.ts
+ function getTrackedPathname(url, trackUrlFragments = false) {
+ if (url.hash.startsWith("#/")) {
+ return url.hash.substring(1);
+ }
+ if (url.hash.startsWith("#!/")) {
+ return url.hash.substring(2);
+ }
+ return url.pathname + (trackUrlFragments ? url.hash : "");
+ }
+
// config.ts
var FEATURE_FLAG_REQUEST_TIMEOUT_MS = 2e3;
function createVisitorId() {
@@ -96,13 +107,7 @@
return void 0;
}
}
- function getEvaluationPathname(url) {
- if (url.hash && url.hash.startsWith("#/")) {
- return url.hash.substring(1);
- }
- return url.pathname;
- }
- async function fetchFeatureFlags(analyticsHost, siteId, namespace, visitorId) {
+ async function fetchFeatureFlags(analyticsHost, siteId, namespace, visitorId, trackUrlFragments) {
const controller = new AbortController();
const timeout = window.setTimeout(() => controller.abort(), FEATURE_FLAG_REQUEST_TIMEOUT_MS);
try {
@@ -118,7 +123,7 @@
anonymousId: visitorId,
identifiedUserId: getIdentifiedUserId(namespace),
hostname: url.hostname,
- pathname: getEvaluationPathname(url),
+ pathname: getTrackedPathname(url, trackUrlFragments),
querystring: url.search,
query: Object.fromEntries(url.searchParams.entries()),
referrer: document.referrer,
@@ -209,6 +214,7 @@
autoTrackPageview: true,
autoTrackSpa: true,
trackQuerystring: true,
+ trackUrlFragments: false,
trackOutbound: true,
enableWebVitals: false,
trackErrors: false,
@@ -248,6 +254,7 @@
autoTrackPageview: apiConfig.trackInitialPageView ?? defaultConfig.autoTrackPageview,
autoTrackSpa: apiConfig.trackSpaNavigation ?? defaultConfig.autoTrackSpa,
trackQuerystring: apiConfig.trackUrlParams ?? defaultConfig.trackQuerystring,
+ trackUrlFragments: apiConfig.trackUrlFragments ?? defaultConfig.trackUrlFragments,
trackOutbound: apiConfig.trackOutbound ?? defaultConfig.trackOutbound,
enableWebVitals: apiConfig.webVitals ?? defaultConfig.enableWebVitals,
trackErrors: apiConfig.trackErrors ?? defaultConfig.trackErrors,
@@ -265,7 +272,13 @@
}
if (resolvedConfig.featureFlagsEnabled) {
resolvedConfig.visitorId = getOrCreateVisitorId(namespace);
- const result = await fetchFeatureFlags(analyticsHost, siteId, namespace, resolvedConfig.visitorId);
+ const result = await fetchFeatureFlags(
+ analyticsHost,
+ siteId,
+ namespace,
+ resolvedConfig.visitorId,
+ resolvedConfig.trackUrlFragments
+ );
resolvedConfig.featureFlagsEnabled = result.enabled;
resolvedConfig.featureFlags = result.flags;
}
@@ -684,6 +697,7 @@
this.errorDedupeLastCleanup = 0;
this.exposedFeatureFlags = /* @__PURE__ */ new Set();
this.config = config;
+ this.lastPageviewUrl = this.getPageviewUrl();
this.loadUserId();
if (config.enableSessionReplay) {
this.initializeSessionReplay();
@@ -708,7 +722,7 @@
}
getCurrentUrlContext() {
const url = new URL(window.location.href);
- const pathname = url.hash && url.hash.startsWith("#/") ? url.hash.substring(1) : url.pathname;
+ const pathname = getTrackedPathname(url, this.config.trackUrlFragments);
return {
hostname: url.hostname,
pathname,
@@ -791,10 +805,7 @@
}
createBasePayload() {
const url = new URL(window.location.href);
- let pathname = url.pathname;
- if (url.hash && url.hash.startsWith("#/")) {
- pathname = url.hash.substring(1);
- }
+ let pathname = getTrackedPathname(url, this.config.trackUrlFragments);
if (findMatchingPattern(pathname, this.config.skipPatterns)) {
return null;
}
@@ -869,8 +880,22 @@
this.sendTrackingData(payload);
}
trackPageview() {
+ this.lastPageviewUrl = this.getPageviewUrl();
this.track("pageview");
}
+ trackPageviewIfUrlChanged() {
+ if (this.getPageviewUrl() !== this.lastPageviewUrl) {
+ this.trackPageview();
+ }
+ }
+ getPageviewUrl() {
+ const url = new URL(window.location.href);
+ return JSON.stringify([
+ url.hostname,
+ getTrackedPathname(url, this.config.trackUrlFragments),
+ this.config.trackQuerystring ? url.search : ""
+ ]);
+ }
trackEvent(name, properties = {}) {
this.track("custom_event", name, properties);
}
@@ -1688,7 +1713,7 @@
});
});
}
- const trackPageview = () => tracker.trackPageview();
+ const trackPageview = () => tracker.trackPageviewIfUrlChanged();
const debouncedTrackPageview = config.debounceDuration > 0 ? debounce(trackPageview, config.debounceDuration) : trackPageview;
function setupEventListeners() {
document.addEventListener("click", function(e2) {
diff --git a/server/public/script.js b/server/public/script.js
index 5171d8f49..519d3b99a 100644
--- a/server/public/script.js
+++ b/server/public/script.js
@@ -1 +1 @@
-"use strict";(()=>{var ze=Object.defineProperty;var $e=(r,e,t)=>e in r?ze(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var w=(r,e,t)=>$e(r,typeof e!="symbol"?e+"":e,t);function Ke(r){if(r.startsWith("re:")){let c=r.slice(3);if(!c)throw new Error("Empty regex pattern");return new RegExp(c)}let t="__DOUBLE_ASTERISK_TOKEN__",n="__SINGLE_ASTERISK_TOKEN__",s=r.replace(/\*\*/g,t).replace(/\*/g,n).replace(/[.+?^${}()|[\]\\]/g,"\\$&");s=s.replace(new RegExp(`/${t}/`,"g"),"/(?:.+/)?"),s=s.replace(new RegExp(t,"g"),".*"),s=s.replace(/\//g,"\\/");let a=s.replace(new RegExp(n,"g"),"[^/]+");return new RegExp("^"+a+"$")}function V(r,e){for(let t of e)try{if(Ke(t).test(r))return t}catch(n){console.error(`Invalid pattern: ${t}`,n)}return null}function le(r,e){let t=null;return(...n)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...n),e)}}function ce(r){try{let e=window.location.hostname,t=new URL(r).hostname;return t!==e&&t!==""}catch{return!1}}function I(r,e){if(!r)return e;try{let t=JSON.parse(r);return Array.isArray(e)&&!Array.isArray(t)?e:t}catch(t){return console.error("Error parsing JSON:",t),e}}var qe=2e3;function G(){try{if(crypto?.randomUUID)return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,12)}`}function Je(r){let e=`${r}-visitor-id`;try{let t=localStorage.getItem(e);if(t)return t;let n=G();return localStorage.setItem(e,n),n}catch{return G()}}function Xe(r){try{return localStorage.getItem(`${r}-user-id`)||void 0}catch{return}}function Qe(r){return r.hash&&r.hash.startsWith("#/")?r.hash.substring(1):r.pathname}async function Ye(r,e,t,n){let i=new AbortController,s=window.setTimeout(()=>i.abort(),qe);try{let a=new URL(window.location.href),c=await fetch(`${r}/site/${e}/feature-flags/evaluate`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",signal:i.signal,body:JSON.stringify({anonymousId:n,identifiedUserId:Xe(t),hostname:a.hostname,pathname:Qe(a),querystring:a.search,query:Object.fromEntries(a.searchParams.entries()),referrer:document.referrer,language:navigator.language,screenWidth:screen.width,screenHeight:screen.height})});if(!c.ok)return{enabled:!0,flags:{}};let u=await c.json();return{enabled:u?.featureFlagsEnabled!==!1,flags:u?.flags&&typeof u.flags=="object"?u.flags:{}}}catch{return{enabled:!0,flags:{}}}finally{window.clearTimeout(s)}}function Ze(r){try{let e=new URL(r,window.location.href);return e.searchParams.get("siteId")||e.searchParams.get("site-id")||e.searchParams.get("site_id")}catch{return null}}async function ue(r){let e=r.getAttribute("src");if(!e)return console.error("Script src attribute is missing"),null;let t=e.split("/script.js")[0];if(!t)return console.error("Please provide a valid analytics host"),null;let n=Ze(e)||r.getAttribute("data-site-id")||r.getAttribute("site-id");if(!n)return console.error("Please provide a valid site ID using the ?siteId= query parameter or the data-site-id attribute"),null;let i=r.getAttribute("data-namespace")||"rybbit",s=G(),a=I(r.getAttribute("data-skip-patterns"),[]),c=I(r.getAttribute("data-mask-patterns"),[]),u=I(r.getAttribute("data-replay-mask-text-selectors"),[]),d=r.getAttribute("data-debounce")?Math.max(0,parseInt(r.getAttribute("data-debounce"))):500,g=r.getAttribute("data-replay-batch-size")?Math.max(1,parseInt(r.getAttribute("data-replay-batch-size"))):250,y=r.getAttribute("data-replay-batch-interval")?Math.max(1e3,parseInt(r.getAttribute("data-replay-batch-interval"))):5e3,T=r.getAttribute("data-replay-block-class")||void 0,h=r.getAttribute("data-replay-block-selector")||void 0,o=r.getAttribute("data-replay-ignore-class")||void 0,l=r.getAttribute("data-replay-ignore-selector")||void 0,p=r.getAttribute("data-replay-mask-text-class")||void 0,S=r.getAttribute("data-replay-mask-all-inputs"),E=S!==null?S!=="false":void 0,R=r.getAttribute("data-replay-mask-input-options"),Ue=R?I(R,{password:!0,email:!0}):void 0,re=r.getAttribute("data-replay-collect-fonts"),He=re!==null?re!=="false":void 0,ie=r.getAttribute("data-replay-sampling"),We=ie?I(ie,{}):void 0,se=r.getAttribute("data-replay-slim-dom-options"),Ve=se?I(se,{}):void 0,ae=r.getAttribute("data-replay-sample-rate"),Ge=ae?Math.min(100,Math.max(0,parseInt(ae,10))):void 0,je=r.getAttribute("data-tag")||"",f={namespace:i,analyticsHost:t,siteId:n,visitorId:s,debounceDuration:d,sessionReplayBatchSize:g,sessionReplayBatchInterval:y,sessionReplayMaskTextSelectors:u,skipPatterns:a,maskPatterns:c,autoTrackPageview:!0,autoTrackSpa:!0,trackQuerystring:!0,trackOutbound:!0,enableWebVitals:!1,trackErrors:!1,enableSessionReplay:!1,trackButtonClicks:!1,trackCopy:!1,trackFormInteractions:!1,tag:je,featureFlagsEnabled:!1,featureFlags:{},sessionReplayBlockClass:T,sessionReplayBlockSelector:h,sessionReplayIgnoreClass:o,sessionReplayIgnoreSelector:l,sessionReplayMaskTextClass:p,sessionReplayMaskAllInputs:E,sessionReplayMaskInputOptions:Ue,sessionReplayCollectFonts:He,sessionReplaySampling:We,sessionReplaySlimDOMOptions:Ve,sessionReplaySampleRate:Ge},C=f;try{let P=`${t}/site/tracking-config/${n}`,oe=await fetch(P,{method:"GET",credentials:"omit"});if(oe.ok){let m=await oe.json();C={...f,autoTrackPageview:m.trackInitialPageView??f.autoTrackPageview,autoTrackSpa:m.trackSpaNavigation??f.autoTrackSpa,trackQuerystring:m.trackUrlParams??f.trackQuerystring,trackOutbound:m.trackOutbound??f.trackOutbound,enableWebVitals:m.webVitals??f.enableWebVitals,trackErrors:m.trackErrors??f.trackErrors,enableSessionReplay:m.sessionReplay??f.enableSessionReplay,trackButtonClicks:m.trackButtonClicks??f.trackButtonClicks,trackCopy:m.trackCopy??f.trackCopy,trackFormInteractions:m.trackFormInteractions??f.trackFormInteractions,featureFlagsEnabled:m.featureFlagsEnabled===!0}}else console.warn("Failed to fetch tracking config from API, using defaults")}catch(P){console.warn("Error fetching tracking config:",P)}if(C.featureFlagsEnabled){C.visitorId=Je(i);let P=await Ye(t,n,i,C.visitorId);C.featureFlagsEnabled=P.enabled,C.featureFlags=P.flags}return C}var de="rybbit-replay-sampled";function et(r){if(r>=100)return!0;if(r<=0)return!1;try{let e=sessionStorage.getItem(de);if(e!==null)return e==="1";let t=Math.random()*100<r;return sessionStorage.setItem(de,t?"1":"0"),t}catch{return Math.random()*100<r}}var M=class{constructor(e,t,n){this.isRecording=!1;this.eventBuffer=[];this.config=e,this.userId=t,this.sendBatch=n}async initialize(){if(!this.config.enableSessionReplay)return;let e=this.config.sessionReplaySampleRate;e!==void 0&&!et(e)||(window.rrweb||await this.loadRrweb(),window.rrweb&&this.startRecording())}async loadRrweb(){return new Promise((e,t)=>{let n=document.createElement("script");n.src=`${this.config.analyticsHost}/replay.js`,n.async=!1,n.onload=()=>{e()},n.onerror=()=>t(new Error("Failed to load rrweb")),document.head.appendChild(n)})}startRecording(){if(!(this.isRecording||!window.rrweb||!this.config.enableSessionReplay))try{let e={mousemove:!1,mouseInteraction:{MouseUp:!1,MouseDown:!1,Click:!0,ContextMenu:!1,DblClick:!0,Focus:!0,Blur:!0,TouchStart:!1,TouchEnd:!1},scroll:500,input:"last",media:800},t={script:!1,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0},n={emit:i=>{this.addEvent({type:i.type,data:i.data,timestamp:i.timestamp||Date.now()})},recordCanvas:!1,checkoutEveryNms:6e4,checkoutEveryNth:500,blockClass:this.config.sessionReplayBlockClass??"rr-block",blockSelector:this.config.sessionReplayBlockSelector??null,ignoreClass:this.config.sessionReplayIgnoreClass??"rr-ignore",ignoreSelector:this.config.sessionReplayIgnoreSelector??null,maskTextClass:this.config.sessionReplayMaskTextClass??"rr-mask",maskAllInputs:this.config.sessionReplayMaskAllInputs??!0,maskInputOptions:this.config.sessionReplayMaskInputOptions??{password:!0,email:!0},collectFonts:this.config.sessionReplayCollectFonts??!0,sampling:this.config.sessionReplaySampling??e,slimDOMOptions:this.config.sessionReplaySlimDOMOptions??t};this.config.sessionReplayMaskTextSelectors&&this.config.sessionReplayMaskTextSelectors.length>0&&(n.maskTextSelector=this.config.sessionReplayMaskTextSelectors.join(", ")),this.stopRecordingFn=window.rrweb.record(n),this.isRecording=!0,this.setupBatchTimer()}catch{}}stopRecording(){this.isRecording&&(this.stopRecordingFn&&this.stopRecordingFn(),this.isRecording=!1,this.clearBatchTimer(),this.eventBuffer.length>0&&this.flushEvents())}isActive(){return this.isRecording}addEvent(e){this.eventBuffer.push(e),this.eventBuffer.length>=this.config.sessionReplayBatchSize&&this.flushEvents()}setupBatchTimer(){this.clearBatchTimer(),this.batchTimer=window.setInterval(()=>{this.eventBuffer.length>0&&this.flushEvents()},this.config.sessionReplayBatchInterval)}clearBatchTimer(){this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=void 0)}async flushEvents(){if(this.eventBuffer.length===0)return;let e=[...this.eventBuffer];this.eventBuffer=[];let t={userId:this.userId,events:e,metadata:{pageUrl:window.location.href,viewportWidth:screen.width,viewportHeight:screen.height,language:navigator.language}};try{await this.sendBatch(t)}catch{this.eventBuffer.unshift(...e)}}updateUserId(e){e!==this.userId&&(this.eventBuffer.length>0&&this.flushEvents(),this.userId=e)}onPageChange(){this.isRecording&&this.flushEvents()}cleanup(){this.stopRecording()}};var b={automationApi:1,zeroOuterDimensions:2,missingChrome:4,swiftShader:8,emptyPlugins:16,defaultViewport800x600:32,defaultViewport1024x768:64,impossibleDimensions:128,outerDimensionsWeird:256,pluginApiAbsence:512,defaultViewport1280x1200:1024,squareScreen:2048,missingScreenDimensions:4096},tt=Object.keys(b),he={automationApi:3,zeroOuterDimensions:2,missingChrome:1,swiftShader:1,emptyPlugins:1,defaultViewport800x600:3,defaultViewport1024x768:3,impossibleDimensions:3,outerDimensionsWeird:2,pluginApiAbsence:0,defaultViewport1280x1200:3,squareScreen:3,missingScreenDimensions:1},ft=tt.reduce((r,e)=>r|b[e],0),mt=b.automationApi|b.impossibleDimensions|b.defaultViewport800x600|b.defaultViewport1024x768|b.defaultViewport1280x1200|b.squareScreen,fe=10,pe=200,ge=8192,nt=[{width:800,height:600,signal:"defaultViewport800x600"},{width:1024,height:768,signal:"defaultViewport1024x768"},{width:1280,height:1200,signal:"defaultViewport1280x1200"}];function rt(r,e){return Number.isFinite(r)&&Number.isFinite(e)&&r>=pe&&e>=pe&&r<=ge&&e<=ge}function it(r){return/Windows NT|Macintosh|X11|Linux x86_64/.test(r)&&!/Mobile|Android|iPhone|iPad/.test(r)}function me(r,e,t){if(!rt(r,e))return["impossibleDimensions"];let n=[];if(r===e&&n.push("squareScreen"),it(t))for(let i of nt)r===i.width&&e===i.height&&n.push(i.signal);return n}var ye=null;function ve(){return Se().score}function ke(){return Se().mask}function we(){return document.prerendering===!0}function Se(){return we()?be():(ye??(ye=be()),ye)}function be(){let r=0,e=0;function t(n){let i=b[n];(e&i)===0&&(e|=i,r+=he[n])}try{let n=navigator.userAgent,i=/Chrome\//.test(n)&&!/\bwv\b|; wv\)/.test(n),s=Number(window.screen?.width),a=Number(window.screen?.height),c=Number(window.outerWidth),u=Number(window.outerHeight),d=Number(window.innerWidth),g=Number(window.innerHeight),T=["__webdriver_evaluate","__selenium_evaluate","__webdriver_script_function","__webdriver_script_func","__webdriver_script_fn","__fxdriver_evaluate","__driver_unwrapped","__webdriver_unwrapped","__driver_evaluate","__selenium_unwrapped","__fxdriver_unwrapped","_phantom","callPhantom","__nightmare","domAutomation","domAutomationController"].some(o=>o in window||o in document);(navigator.webdriver===!0||T)&&t("automationApi"),(u===0||c===0)&&!we()&&t("zeroOuterDimensions");for(let o of me(s,a,n))t(o);Number.isFinite(c)&&Number.isFinite(u)&&Number.isFinite(d)&&Number.isFinite(g)&&c>0&&u>0&&d>0&&g>0&&(c+8<d||u+8<g)&&t("outerDimensionsWeird");let h=!1;!window.chrome&&i&&(t("missingChrome"),h=!0);try{let o=document.createElement("canvas"),l=o.getContext("webgl")||o.getContext("experimental-webgl");if(l)try{let p=[],S=l.getParameter(l.RENDERER);typeof S=="string"&&p.push(S);try{let E=l.getExtension("WEBGL_debug_renderer_info");if(E){let R=l.getParameter(E.UNMASKED_RENDERER_WEBGL);typeof R=="string"&&p.push(R)}}catch{}p.join(" ").toLowerCase().includes("swiftshader")&&t("swiftShader")}finally{st(o,l)}}catch{}(!navigator.plugins||navigator.plugins.length===0)&&i&&(t("emptyPlugins"),h=!0),h&&t("pluginApiAbsence")}catch{}return{score:Math.min(r,fe),mask:e}}function st(r,e){try{e.getExtension("WEBGL_lose_context")?.loseContext?.()}catch{}r.width=0,r.height=0}var at=2e3,x=class{constructor(e){this.customUserId=null;this.errorDedupeCache=new Map;this.errorDedupeLastCleanup=0;this.exposedFeatureFlags=new Set;this.config=e,this.loadUserId(),e.enableSessionReplay&&this.initializeSessionReplay()}serializeFeatureFlagValue(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return""}}getFeatureFlagEventPayload(){let e={};for(let[t,n]of Object.entries(this.config.featureFlags||{}))e[t]=this.serializeFeatureFlagValue(n.value);return e}getCurrentUrlContext(){let e=new URL(window.location.href),t=e.hash&&e.hash.startsWith("#/")?e.hash.substring(1):e.pathname;return{hostname:e.hostname,pathname:t,querystring:e.search,query:Object.fromEntries(e.searchParams.entries()),referrer:document.referrer,language:navigator.language,screenWidth:screen.width,screenHeight:screen.height}}async refreshFeatureFlags(){if(!this.config.featureFlagsEnabled)return;let e=new AbortController,t=window.setTimeout(()=>e.abort(),at);try{let n=await fetch(`${this.config.analyticsHost}/site/${this.config.siteId}/feature-flags/evaluate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({anonymousId:this.config.visitorId,identifiedUserId:this.customUserId||void 0,...this.getCurrentUrlContext()}),mode:"cors",credentials:"omit",keepalive:!0,signal:e.signal});if(!n.ok)return;let i=await n.json();this.config.featureFlags=i?.flags&&typeof i.flags=="object"?i.flags:{},i?.featureFlagsEnabled===!1&&(this.config.featureFlagsEnabled=!1)}catch{}finally{window.clearTimeout(t)}}loadUserId(){try{let e=localStorage.getItem(`${this.config.namespace}-user-id`);e&&(this.customUserId=e)}catch{}}async initializeSessionReplay(){try{this.sessionReplayRecorder=new M(this.config,this.customUserId||"",e=>this.sendSessionReplayBatch(e)),await this.sessionReplayRecorder.initialize()}catch(e){console.error("Failed to initialize session replay:",e)}}async sendSessionReplayBatch(e){try{await fetch(`${this.config.analyticsHost}/session-replay/record/${this.config.siteId}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),mode:"cors",keepalive:!1})}catch(t){throw console.error("Failed to send session replay batch:",t),t}}createBasePayload(){let e=new URL(window.location.href),t=e.pathname;if(e.hash&&e.hash.startsWith("#/")&&(t=e.hash.substring(1)),V(t,this.config.skipPatterns))return null;let n=V(t,this.config.maskPatterns);n&&(t=n);let i={site_id:this.config.siteId,hostname:e.hostname,pathname:t,querystring:this.config.trackQuerystring?e.search:"",screenWidth:screen.width,screenHeight:screen.height,language:navigator.language,page_title:document.title,referrer:document.referrer,_bs:ve(),_bsm:ke()};this.customUserId&&(i.user_id=this.customUserId),this.config.tag&&(i.tag=this.config.tag);let s=this.getFeatureFlagEventPayload();return Object.keys(s).length>0&&(i.feature_flags=s),i}async sendTrackingData(e){try{await fetch(`${this.config.analyticsHost}/track`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),mode:"cors",keepalive:!0})}catch(t){console.error("Failed to send tracking data:",t)}}track(e,t="",n={}){if(e==="custom_event"&&(!t||typeof t!="string")){console.error("Event name is required and must be a string for custom events");return}let i=this.createBasePayload();if(!i)return;let a={...i,type:e,event_name:t,properties:["custom_event","outbound","error","button_click","copy","form_submit","input_change"].includes(e)?JSON.stringify(n):void 0};this.sendTrackingData(a)}trackPageview(){this.track("pageview")}trackEvent(e,t={}){this.track("custom_event",e,t)}getFeatureFlag(e,t){let n=this.config.featureFlags?.[e];if(!n)return t;let i=`${e}:${n.version}:${this.serializeFeatureFlagValue(n.value)}`;return this.exposedFeatureFlags.has(i)||(this.exposedFeatureFlags.add(i),this.trackEvent("feature_flag_exposure",{key:e,value:this.serializeFeatureFlagValue(n.value),version:n.version,reason:n.reason})),n.value}getFeatureFlags(){return Object.fromEntries(Object.entries(this.config.featureFlags||{}).map(([e,t])=>[e,t.value]))}getFeatureFlagPayload(e,t){let n=this.config.featureFlags?.[e];return!n||n.payload===void 0?t:n.payload}getFeatureFlagPayloads(){return Object.fromEntries(Object.entries(this.config.featureFlags||{}).filter(([,e])=>e.payload!==void 0).map(([e,t])=>[e,t.payload]))}trackOutbound(e,t="",n="_self"){this.track("outbound","",{url:e,text:t,target:n})}trackWebVitals(e){let t=this.createBasePayload();if(!t)return;let n={...t,type:"performance",event_name:"web-vitals",...e};this.sendTrackingData(n)}trackError(e,t={}){let n=e?.message||"";if(n.includes("ResizeObserver loop completed with undelivered notifications")||n.includes("ResizeObserver loop limit exceeded"))return;let i=window.location.origin,s=t.filename||"",a=e.stack||"";if(s)try{if(new URL(s).origin!==i)return}catch{}else if(a&&!a.includes(i))return;let u=[e.name||"Error",n,t.filename||"",t.lineno??"",t.colno??""].join("|"),d=Date.now(),g=6e4,y=this.errorDedupeCache.get(u);if(y&&d-y<g)return;this.errorDedupeCache.set(u,d);let T=10*6e4;if(d-this.errorDedupeLastCleanup>g){for(let[o,l]of this.errorDedupeCache.entries())d-l>T&&this.errorDedupeCache.delete(o);this.errorDedupeLastCleanup=d}let h={message:e.message?.substring(0,500)||"Unknown error",stack:a.substring(0,2e3)||""};if(s&&(h.fileName=s),t.lineno){let o=typeof t.lineno=="string"?parseInt(t.lineno,10):t.lineno;o&&o!==0&&(h.lineNumber=o)}if(t.colno){let o=typeof t.colno=="string"?parseInt(t.colno,10):t.colno;o&&o!==0&&(h.columnNumber=o)}for(let o in t)!["lineno","colno"].includes(o)&&t[o]!==void 0&&(h[o]=t[o]);this.track("error",e.name||"Error",h)}trackButtonClick(e){this.track("button_click","",e)}trackCopy(e){this.track("copy","",e)}trackFormSubmit(e){this.track("form_submit","",e)}trackInputChange(e){this.track("input_change","",e)}identify(e,t){if(typeof e!="string"||e.trim()===""){console.error("User ID must be a non-empty string");return}this.customUserId=e.trim();try{localStorage.setItem(`${this.config.namespace}-user-id`,this.customUserId)}catch{console.warn("Could not persist user ID to localStorage")}this.sendIdentifyEvent(this.customUserId,t,!0).then(()=>this.refreshFeatureFlags()),this.sessionReplayRecorder&&this.sessionReplayRecorder.updateUserId(this.customUserId)}setTraits(e){if(!e||typeof e!="object"){console.error("Traits must be an object");return}let t=this.customUserId;if(!t){console.warn("Cannot set traits without identifying user first. Call identify() first.");return}this.sendIdentifyEvent(t,e,!1).then(()=>this.refreshFeatureFlags())}async sendIdentifyEvent(e,t,n=!0){try{await fetch(`${this.config.analyticsHost}/identify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({site_id:this.config.siteId,user_id:e,traits:t,is_new_identify:n}),mode:"cors",keepalive:!0})}catch(i){console.error("Failed to send identify event:",i)}}clearUserId(){this.customUserId=null;try{localStorage.removeItem(`${this.config.namespace}-user-id`)}catch{}this.sessionReplayRecorder&&this.sessionReplayRecorder.updateUserId(""),this.refreshFeatureFlags()}getUserId(){return this.customUserId}startSessionReplay(){this.sessionReplayRecorder?this.sessionReplayRecorder.startRecording():console.warn("Session replay not initialized")}stopSessionReplay(){this.sessionReplayRecorder&&this.sessionReplayRecorder.stopRecording()}isSessionReplayActive(){return this.sessionReplayRecorder?.isActive()??!1}onPageChange(){this.refreshFeatureFlags(),this.sessionReplayRecorder&&this.sessionReplayRecorder.onPageChange()}cleanup(){this.sessionReplayRecorder&&this.sessionReplayRecorder.cleanup()}};var Le=-1,A=r=>{addEventListener("pageshow",(e=>{e.persisted&&(Le=e.timeStamp,r(e))}),!0)},v=(r,e,t,n)=>{let i,s;return a=>{e.value>=0&&(a||n)&&(s=e.value-(i??0),(s||i===void 0)&&(i=e.value,e.delta=s,e.rating=((c,u)=>c>u[1]?"poor":c>u[0]?"needs-improvement":"good")(e.value,t),r(e)))}},Y=r=>{requestAnimationFrame((()=>requestAnimationFrame((()=>r()))))},Z=()=>{let r=performance.getEntriesByType("navigation")[0];if(r&&r.responseStart>0&&r.responseStart<performance.now())return r},L=()=>Z()?.activationStart??0,k=(r,e=-1)=>{let t=Z(),n="navigate";return Le>=0?n="back-forward-cache":t&&(document.prerendering||L()>0?n="prerender":document.wasDiscarded?n="restore":t.type&&(n=t.type.replace(/_/g,"-"))),{name:r,value:e,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},j=new WeakMap;function ee(r,e){return j.get(r)||j.set(r,new e),j.get(r)}var $=class{constructor(){w(this,"t");w(this,"i",0);w(this,"o",[])}h(e){if(e.hadRecentInput)return;let t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},F=(r,e,t={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(r)){let n=new PerformanceObserver((i=>{Promise.resolve().then((()=>{e(i.getEntries())}))}));return n.observe({type:r,buffered:!0,...t}),n}}catch{}},te=r=>{let e=!1;return()=>{e||(r(),e=!0)}},_=-1,Fe=new Set,Ee=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,K=r=>{if(document.visibilityState==="hidden"){if(r.type==="visibilitychange")for(let e of Fe)e();isFinite(_)||(_=r.type==="visibilitychange"?r.timeStamp:0,removeEventListener("prerenderingchange",K,!0))}},N=()=>{if(_<0){let r=L();_=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>t.name==="hidden"&&t.startTime>r))[0]?.startTime)??Ee(),addEventListener("visibilitychange",K,!0),addEventListener("prerenderingchange",K,!0),A((()=>{setTimeout((()=>{_=Ee()}))}))}return{get firstHiddenTime(){return _},onHidden(r){Fe.add(r)}}},O=r=>{document.prerendering?addEventListener("prerenderingchange",(()=>r()),!0):r()},Te=[1800,3e3],ne=(r,e={})=>{O((()=>{let t=N(),n,i=k("FCP"),s=F("paint",(a=>{for(let c of a)c.name==="first-contentful-paint"&&(s.disconnect(),c.startTime<t.firstHiddenTime&&(i.value=Math.max(c.startTime-L(),0),i.entries.push(c),n(!0)))}));s&&(n=v(r,i,Te,e.reportAllChanges),A((a=>{i=k("FCP"),n=v(r,i,Te,e.reportAllChanges),Y((()=>{i.value=performance.now()-a.timeStamp,n(!0)}))})))}))},Re=[.1,.25],Me=(r,e={})=>{let t=N();ne(te((()=>{let n,i=k("CLS",0),s=ee(e,$),a=u=>{for(let d of u)s.h(d);s.i>i.value&&(i.value=s.i,i.entries=s.o,n())},c=F("layout-shift",a);c&&(n=v(r,i,Re,e.reportAllChanges),t.onHidden((()=>{a(c.takeRecords()),n(!0)})),A((()=>{s.i=0,i=k("CLS",0),n=v(r,i,Re,e.reportAllChanges),Y((()=>n()))})),setTimeout(n))})))},xe=0,z=1/0,B=0,ot=r=>{for(let e of r)e.interactionId&&(z=Math.min(z,e.interactionId),B=Math.max(B,e.interactionId),xe=B?(B-z)/7+1:0)},q,Ce=()=>q?xe:performance.interactionCount??0,lt=()=>{"interactionCount"in performance||q||(q=F("event",ot,{type:"event",buffered:!0,durationThreshold:0}))},Ie=0,J=class{constructor(){w(this,"u",[]);w(this,"l",new Map);w(this,"m");w(this,"p")}v(){Ie=Ce(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((Ce()-Ie)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&e.entryType!=="first-input")return;let t=this.u.at(-1),n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((i,s)=>s.P-i.P)),this.u.length>10){let i=this.u.splice(10);for(let s of i)this.l.delete(s.id)}this.p?.(n)}}},Be=r=>{let e=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?r():(r=te(r),addEventListener("visibilitychange",r,{once:!0,capture:!0}),e((()=>{r(),removeEventListener("visibilitychange",r,{capture:!0})})))},Pe=[200,500],Ne=(r,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let t=N();O((()=>{lt();let n,i=k("INP"),s=ee(e,J),a=u=>{Be((()=>{for(let g of u)s.h(g);let d=s.L();d&&d.P!==i.value&&(i.value=d.P,i.entries=d.entries,n())}))},c=F("event",a,{durationThreshold:e.durationThreshold??40});n=v(r,i,Pe,e.reportAllChanges),c&&(c.observe({type:"first-input",buffered:!0}),t.onHidden((()=>{a(c.takeRecords()),n(!0)})),A((()=>{s.v(),i=k("INP"),n=v(r,i,Pe,e.reportAllChanges)})))}))},X=class{constructor(){w(this,"m")}h(e){this.m?.(e)}},_e=[2500,4e3],Oe=(r,e={})=>{O((()=>{let t=N(),n,i=k("LCP"),s=ee(e,X),a=u=>{e.reportAllChanges||(u=u.slice(-1));for(let d of u)s.h(d),d.startTime<t.firstHiddenTime&&(i.value=Math.max(d.startTime-L(),0),i.entries=[d],n())},c=F("largest-contentful-paint",a);if(c){n=v(r,i,_e,e.reportAllChanges);let u=te((()=>{a(c.takeRecords()),c.disconnect(),n(!0)})),d=g=>{g.isTrusted&&(Be(u),removeEventListener(g.type,d,{capture:!0}))};for(let g of["keydown","click","visibilitychange"])addEventListener(g,d,{capture:!0});A((g=>{i=k("LCP"),n=v(r,i,_e,e.reportAllChanges),Y((()=>{i.value=performance.now()-g.timeStamp,n(!0)}))}))}}))},Ae=[800,1800],Q=r=>{document.prerendering?O((()=>Q(r))):document.readyState!=="complete"?addEventListener("load",(()=>Q(r)),!0):setTimeout(r)},De=(r,e={})=>{let t=k("TTFB"),n=v(r,t,Ae,e.reportAllChanges);Q((()=>{let i=Z();i&&(t.value=Math.max(i.responseStart-L(),0),t.entries=[i],n(!0),A((()=>{t=k("TTFB",0),n=v(r,t,Ae,e.reportAllChanges),n(!0)})))}))};var D=class{constructor(e){this.data={lcp:null,cls:null,inp:null,fcp:null,ttfb:null};this.sent=!1;this.timeout=null;this.onReadyCallback=null;this.onReadyCallback=e}initialize(){try{Oe(this.collectMetric.bind(this)),Me(this.collectMetric.bind(this)),Ne(this.collectMetric.bind(this)),ne(this.collectMetric.bind(this)),De(this.collectMetric.bind(this)),this.timeout=setTimeout(()=>{this.sent||this.sendData()},2e4),window.addEventListener("beforeunload",()=>{this.sent||this.sendData()})}catch(e){console.warn("Error initializing web vitals tracking:",e)}}collectMetric(e){if(this.sent)return;let t=e.name.toLowerCase();this.data[t]=e.value,Object.values(this.data).every(i=>i!==null)&&this.sendData()}sendData(){this.sent||(this.sent=!0,this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.onReadyCallback&&this.onReadyCallback(this.data))}getData(){return{...this.data}}};var ct=1e3,U=class{constructor(e,t){this.lastClickAt=new WeakMap;this.tracker=e,this.config=t}initialize(){document.addEventListener("click",this.handleClick.bind(this),!0)}handleClick(e){let t=e.target;this.config.trackButtonClicks&&this.isButton(t)&&this.trackButtonClick(t)}isButton(e){if(e.tagName==="BUTTON"||e.getAttribute("role")==="button")return!0;if(e.tagName==="INPUT"){let i=e.type?.toLowerCase();if(i==="submit"||i==="button")return!0}let t=e.parentElement,n=0;for(;t&&n<3;){if(t.tagName==="BUTTON"||t.getAttribute("role")==="button")return!0;t=t.parentElement,n++}return!1}trackButtonClick(e){let t=this.findButton(e);if(!t||t.hasAttribute("data-rybbit-event"))return;let n=Date.now(),i=this.lastClickAt.get(t);if(i!==void 0&&n-i<ct)return;this.lastClickAt.set(t,n);let s={text:this.getElementText(t),...this.extractDataAttributes(t)};this.tracker.trackButtonClick(s)}extractDataAttributes(e){let t={};for(let n of e.attributes)if(n.name.startsWith("data-rybbit-prop-")){let i=n.name.replace("data-rybbit-prop-","");t[i]=n.value}return t}findButton(e){if(e.tagName==="BUTTON"||e.getAttribute("role")==="button")return e;if(e.tagName==="INPUT"){let i=e.type?.toLowerCase();if(i==="submit"||i==="button")return e}let t=e.parentElement,n=0;for(;t&&n<3;){if(t.tagName==="BUTTON"||t.getAttribute("role")==="button")return t;t=t.parentElement,n++}return null}getElementText(e){let t=e.textContent?.trim().substring(0,100);if(t)return t;let n=e.getAttribute("aria-label")?.trim().substring(0,100);if(n)return n;if(e.tagName==="INPUT"){let s=e.value?.trim().substring(0,100);if(s)return s}let i=e.getAttribute("title")?.trim().substring(0,100);if(i)return i}cleanup(){document.removeEventListener("click",this.handleClick.bind(this),!0)}};var H=class{constructor(e){this.tracker=e}initialize(){document.addEventListener("copy",this.handleCopy.bind(this))}handleCopy(){let e=window.getSelection();if(!e||e.isCollapsed)return;let t=e.toString(),n=t.length;if(n===0)return;let i=e.anchorNode,s=i instanceof HTMLElement?i:i?.parentElement;if(!s)return;let a={text:t.substring(0,500),...n>500&&{textLength:n},sourceElement:s.tagName.toLowerCase()};this.tracker.trackCopy(a)}cleanup(){document.removeEventListener("copy",this.handleCopy.bind(this))}};var W=class{constructor(e,t){this.tracker=e,this.config=t,this.boundHandleSubmit=this.handleSubmit.bind(this),this.boundHandleChange=this.handleChange.bind(this)}initialize(){document.addEventListener("submit",this.boundHandleSubmit,!0),document.addEventListener("change",this.boundHandleChange,!0)}cleanup(){document.removeEventListener("submit",this.boundHandleSubmit,!0),document.removeEventListener("change",this.boundHandleChange,!0)}handleSubmit(e){let t=e.target;if(t.tagName!=="FORM")return;let n={formId:t.id||"",formName:t.name||"",formAction:t.action||"",method:(t.method||"get").toUpperCase(),fieldCount:t.elements.length,ariaLabel:t.getAttribute("aria-label")||void 0,...this.extractDataAttributes(t)};this.tracker.trackFormSubmit(n)}handleChange(e){let t=e.target;if(!(t instanceof Element))return;let n=t.tagName.toUpperCase();if(!["INPUT","SELECT","TEXTAREA"].includes(n)||t.disabled||t.readOnly)return;if(n==="INPUT"){let a=t.type?.toLowerCase();if(a==="hidden"||a==="password")return}let i=t.name||t.id||t.getAttribute("aria-label")||t.placeholder||"",s={element:n.toLowerCase(),inputType:n==="INPUT"?t.type?.toLowerCase():void 0,inputName:i,formId:t.form?.id||void 0,formName:t.form?.name||void 0,...this.extractDataAttributes(t)};this.tracker.trackInputChange(s)}extractDataAttributes(e){let t={};for(let n of e.attributes)if(n.name.startsWith("data-rybbit-prop-")){let i=n.name.replace("data-rybbit-prop-","");t[i]=n.value}return t}};(async function(){let r=document.currentScript||document.querySelector('script[src*="/script.js"]');if(!r){console.error("Could not find current script tag");return}let e=r.getAttribute("data-namespace")||"rybbit",t=`disable-${e}`;if(window.__RYBBIT_OPTOUT__||localStorage.getItem(t)!==null){window[e]={pageview:()=>{},event:()=>{},error:()=>{},trackOutbound:()=>{},identify:()=>{},setTraits:()=>{},clearUserId:()=>{},getUserId:()=>null,flag:(o,l)=>l,flagPayload:(o,l)=>l,flags:()=>({}),flagPayloads:()=>({}),onReady:()=>{},startSessionReplay:()=>{},stopSessionReplay:()=>{},isSessionReplayActive:()=>!1};return}let n=[],i=o=>(...l)=>{n.push([o,l])};window[e]={pageview:i("pageview"),event:i("event"),error:i("error"),trackOutbound:i("trackOutbound"),identify:i("identify"),setTraits:i("setTraits"),clearUserId:i("clearUserId"),getUserId:()=>null,flag:(o,l)=>l,flagPayload:(o,l)=>l,flags:()=>({}),flagPayloads:()=>({}),onReady:i("onReady"),startSessionReplay:i("startSessionReplay"),stopSessionReplay:i("stopSessionReplay"),isSessionReplayActive:()=>!1};let s=await ue(r);if(!s)return;let a=new x(s);s.enableWebVitals&&new D(l=>{a.trackWebVitals(l)}).initialize();let c=null,u=null,d=null;s.trackButtonClicks&&(c=new U(a,s),c.initialize()),s.trackCopy&&(u=new H(a),u.initialize()),s.trackFormInteractions&&(d=new W(a,s),d.initialize()),s.trackErrors&&(window.addEventListener("error",o=>{a.trackError(o.error||new Error(o.message),{filename:o.filename,lineno:o.lineno,colno:o.colno})}),window.addEventListener("unhandledrejection",o=>{let l=o.reason instanceof Error?o.reason:new Error(String(o.reason));a.trackError(l,{type:"unhandledrejection"})}));let g=()=>a.trackPageview(),y=s.debounceDuration>0?le(g,s.debounceDuration):g;function T(){if(document.addEventListener("click",function(o){let l=o.target;for(;l&&l!==document.documentElement;){if(l.hasAttribute("data-rybbit-event")){let p=l.getAttribute("data-rybbit-event");if(p){let S={};for(let E of l.attributes)if(E.name.startsWith("data-rybbit-prop-")){let R=E.name.replace("data-rybbit-prop-","");S[R]=E.value}a.trackEvent(p,S)}break}l=l.parentElement}if(s.trackOutbound){let p=o.target.closest("a");p?.href&&ce(p.href)&&a.trackOutbound(p.href,p.innerText||p.textContent||"",p.target||"_self")}}),s.autoTrackSpa){let o=history.pushState,l=history.replaceState;history.pushState=function(...p){o.apply(this,p),y(),a.onPageChange()},history.replaceState=function(...p){l.apply(this,p),y(),a.onPageChange()},window.addEventListener("popstate",()=>{y(),a.onPageChange()}),window.addEventListener("hashchange",()=>{y(),a.onPageChange()})}}window[s.namespace]={pageview:()=>a.trackPageview(),event:(o,l={})=>a.trackEvent(o,l),error:(o,l={})=>a.trackError(o,l),trackOutbound:(o,l="",p="_self")=>a.trackOutbound(o,l,p),identify:(o,l)=>a.identify(o,l),setTraits:o=>a.setTraits(o),clearUserId:()=>a.clearUserId(),getUserId:()=>a.getUserId(),flag:(o,l)=>a.getFeatureFlag(o,l),flagPayload:(o,l)=>a.getFeatureFlagPayload(o,l),flags:()=>a.getFeatureFlags(),flagPayloads:()=>a.getFeatureFlagPayloads(),onReady:o=>o(window[s.namespace]),startSessionReplay:()=>a.startSessionReplay(),stopSessionReplay:()=>a.stopSessionReplay(),isSessionReplayActive:()=>a.isSessionReplayActive()};let h=window[s.namespace];for(let[o,l]of n)h[o](...l);T(),window.addEventListener("beforeunload",()=>{c?.cleanup(),u?.cleanup(),a.cleanup()}),s.autoTrackPageview&&a.trackPageview()})();})();
+"use strict";(()=>{var $e=Object.defineProperty;var Ke=(n,e,t)=>e in n?$e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var w=(n,e,t)=>Ke(n,typeof e!="symbol"?e+"":e,t);function qe(n){if(n.startsWith("re:")){let c=n.slice(3);if(!c)throw new Error("Empty regex pattern");return new RegExp(c)}let t="__DOUBLE_ASTERISK_TOKEN__",r="__SINGLE_ASTERISK_TOKEN__",s=n.replace(/\*\*/g,t).replace(/\*/g,r).replace(/[.+?^${}()|[\]\\]/g,"\\$&");s=s.replace(new RegExp(`/${t}/`,"g"),"/(?:.+/)?"),s=s.replace(new RegExp(t,"g"),".*"),s=s.replace(/\//g,"\\/");let o=s.replace(new RegExp(r,"g"),"[^/]+");return new RegExp("^"+o+"$")}function G(n,e){for(let t of e)try{if(qe(t).test(n))return t}catch(r){console.error(`Invalid pattern: ${t}`,r)}return null}function ce(n,e){let t=null;return(...r)=>{t&&clearTimeout(t),t=setTimeout(()=>n(...r),e)}}function ue(n){try{let e=window.location.hostname,t=new URL(n).hostname;return t!==e&&t!==""}catch{return!1}}function I(n,e){if(!n)return e;try{let t=JSON.parse(n);return Array.isArray(e)&&!Array.isArray(t)?e:t}catch(t){return console.error("Error parsing JSON:",t),e}}function _(n,e=!1){return n.hash.startsWith("#/")?n.hash.substring(1):n.hash.startsWith("#!/")?n.hash.substring(2):n.pathname+(e?n.hash:"")}var Je=2e3;function j(){try{if(crypto?.randomUUID)return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,12)}`}function Xe(n){let e=`${n}-visitor-id`;try{let t=localStorage.getItem(e);if(t)return t;let r=j();return localStorage.setItem(e,r),r}catch{return j()}}function Qe(n){try{return localStorage.getItem(`${n}-user-id`)||void 0}catch{return}}async function Ye(n,e,t,r,i){let s=new AbortController,o=window.setTimeout(()=>s.abort(),Je);try{let c=new URL(window.location.href),d=await fetch(`${n}/site/${e}/feature-flags/evaluate`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",signal:s.signal,body:JSON.stringify({anonymousId:r,identifiedUserId:Qe(t),hostname:c.hostname,pathname:_(c,i),querystring:c.search,query:Object.fromEntries(c.searchParams.entries()),referrer:document.referrer,language:navigator.language,screenWidth:screen.width,screenHeight:screen.height})});if(!d.ok)return{enabled:!0,flags:{}};let u=await d.json();return{enabled:u?.featureFlagsEnabled!==!1,flags:u?.flags&&typeof u.flags=="object"?u.flags:{}}}catch{return{enabled:!0,flags:{}}}finally{window.clearTimeout(o)}}function Ze(n){try{let e=new URL(n,window.location.href);return e.searchParams.get("siteId")||e.searchParams.get("site-id")||e.searchParams.get("site_id")}catch{return null}}async function de(n){let e=n.getAttribute("src");if(!e)return console.error("Script src attribute is missing"),null;let t=e.split("/script.js")[0];if(!t)return console.error("Please provide a valid analytics host"),null;let r=Ze(e)||n.getAttribute("data-site-id")||n.getAttribute("site-id");if(!r)return console.error("Please provide a valid site ID using the ?siteId= query parameter or the data-site-id attribute"),null;let i=n.getAttribute("data-namespace")||"rybbit",s=j(),o=I(n.getAttribute("data-skip-patterns"),[]),c=I(n.getAttribute("data-mask-patterns"),[]),d=I(n.getAttribute("data-replay-mask-text-selectors"),[]),u=n.getAttribute("data-debounce")?Math.max(0,parseInt(n.getAttribute("data-debounce"))):500,p=n.getAttribute("data-replay-batch-size")?Math.max(1,parseInt(n.getAttribute("data-replay-batch-size"))):250,y=n.getAttribute("data-replay-batch-interval")?Math.max(1e3,parseInt(n.getAttribute("data-replay-batch-interval"))):5e3,R=n.getAttribute("data-replay-block-class")||void 0,h=n.getAttribute("data-replay-block-selector")||void 0,a=n.getAttribute("data-replay-ignore-class")||void 0,l=n.getAttribute("data-replay-ignore-selector")||void 0,g=n.getAttribute("data-replay-mask-text-class")||void 0,S=n.getAttribute("data-replay-mask-all-inputs"),E=S!==null?S!=="false":void 0,C=n.getAttribute("data-replay-mask-input-options"),He=C?I(C,{password:!0,email:!0}):void 0,ie=n.getAttribute("data-replay-collect-fonts"),We=ie!==null?ie!=="false":void 0,se=n.getAttribute("data-replay-sampling"),Ve=se?I(se,{}):void 0,ae=n.getAttribute("data-replay-slim-dom-options"),Ge=ae?I(ae,{}):void 0,oe=n.getAttribute("data-replay-sample-rate"),je=oe?Math.min(100,Math.max(0,parseInt(oe,10))):void 0,ze=n.getAttribute("data-tag")||"",f={namespace:i,analyticsHost:t,siteId:r,visitorId:s,debounceDuration:u,sessionReplayBatchSize:p,sessionReplayBatchInterval:y,sessionReplayMaskTextSelectors:d,skipPatterns:o,maskPatterns:c,autoTrackPageview:!0,autoTrackSpa:!0,trackQuerystring:!0,trackUrlFragments:!1,trackOutbound:!0,enableWebVitals:!1,trackErrors:!1,enableSessionReplay:!1,trackButtonClicks:!1,trackCopy:!1,trackFormInteractions:!1,tag:ze,featureFlagsEnabled:!1,featureFlags:{},sessionReplayBlockClass:R,sessionReplayBlockSelector:h,sessionReplayIgnoreClass:a,sessionReplayIgnoreSelector:l,sessionReplayMaskTextClass:g,sessionReplayMaskAllInputs:E,sessionReplayMaskInputOptions:He,sessionReplayCollectFonts:We,sessionReplaySampling:Ve,sessionReplaySlimDOMOptions:Ge,sessionReplaySampleRate:je},T=f;try{let P=`${t}/site/tracking-config/${r}`,le=await fetch(P,{method:"GET",credentials:"omit"});if(le.ok){let m=await le.json();T={...f,autoTrackPageview:m.trackInitialPageView??f.autoTrackPageview,autoTrackSpa:m.trackSpaNavigation??f.autoTrackSpa,trackQuerystring:m.trackUrlParams??f.trackQuerystring,trackUrlFragments:m.trackUrlFragments??f.trackUrlFragments,trackOutbound:m.trackOutbound??f.trackOutbound,enableWebVitals:m.webVitals??f.enableWebVitals,trackErrors:m.trackErrors??f.trackErrors,enableSessionReplay:m.sessionReplay??f.enableSessionReplay,trackButtonClicks:m.trackButtonClicks??f.trackButtonClicks,trackCopy:m.trackCopy??f.trackCopy,trackFormInteractions:m.trackFormInteractions??f.trackFormInteractions,featureFlagsEnabled:m.featureFlagsEnabled===!0}}else console.warn("Failed to fetch tracking config from API, using defaults")}catch(P){console.warn("Error fetching tracking config:",P)}if(T.featureFlagsEnabled){T.visitorId=Xe(i);let P=await Ye(t,r,i,T.visitorId,T.trackUrlFragments);T.featureFlagsEnabled=P.enabled,T.featureFlags=P.flags}return T}var ge="rybbit-replay-sampled";function et(n){if(n>=100)return!0;if(n<=0)return!1;try{let e=sessionStorage.getItem(ge);if(e!==null)return e==="1";let t=Math.random()*100<n;return sessionStorage.setItem(ge,t?"1":"0"),t}catch{return Math.random()*100<n}}var x=class{constructor(e,t,r){this.isRecording=!1;this.eventBuffer=[];this.config=e,this.userId=t,this.sendBatch=r}async initialize(){if(!this.config.enableSessionReplay)return;let e=this.config.sessionReplaySampleRate;e!==void 0&&!et(e)||(window.rrweb||await this.loadRrweb(),window.rrweb&&this.startRecording())}async loadRrweb(){return new Promise((e,t)=>{let r=document.createElement("script");r.src=`${this.config.analyticsHost}/replay.js`,r.async=!1,r.onload=()=>{e()},r.onerror=()=>t(new Error("Failed to load rrweb")),document.head.appendChild(r)})}startRecording(){if(!(this.isRecording||!window.rrweb||!this.config.enableSessionReplay))try{let e={mousemove:!1,mouseInteraction:{MouseUp:!1,MouseDown:!1,Click:!0,ContextMenu:!1,DblClick:!0,Focus:!0,Blur:!0,TouchStart:!1,TouchEnd:!1},scroll:500,input:"last",media:800},t={script:!1,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0},r={emit:i=>{this.addEvent({type:i.type,data:i.data,timestamp:i.timestamp||Date.now()})},recordCanvas:!1,checkoutEveryNms:6e4,checkoutEveryNth:500,blockClass:this.config.sessionReplayBlockClass??"rr-block",blockSelector:this.config.sessionReplayBlockSelector??null,ignoreClass:this.config.sessionReplayIgnoreClass??"rr-ignore",ignoreSelector:this.config.sessionReplayIgnoreSelector??null,maskTextClass:this.config.sessionReplayMaskTextClass??"rr-mask",maskAllInputs:this.config.sessionReplayMaskAllInputs??!0,maskInputOptions:this.config.sessionReplayMaskInputOptions??{password:!0,email:!0},collectFonts:this.config.sessionReplayCollectFonts??!0,sampling:this.config.sessionReplaySampling??e,slimDOMOptions:this.config.sessionReplaySlimDOMOptions??t};this.config.sessionReplayMaskTextSelectors&&this.config.sessionReplayMaskTextSelectors.length>0&&(r.maskTextSelector=this.config.sessionReplayMaskTextSelectors.join(", ")),this.stopRecordingFn=window.rrweb.record(r),this.isRecording=!0,this.setupBatchTimer()}catch{}}stopRecording(){this.isRecording&&(this.stopRecordingFn&&this.stopRecordingFn(),this.isRecording=!1,this.clearBatchTimer(),this.eventBuffer.length>0&&this.flushEvents())}isActive(){return this.isRecording}addEvent(e){this.eventBuffer.push(e),this.eventBuffer.length>=this.config.sessionReplayBatchSize&&this.flushEvents()}setupBatchTimer(){this.clearBatchTimer(),this.batchTimer=window.setInterval(()=>{this.eventBuffer.length>0&&this.flushEvents()},this.config.sessionReplayBatchInterval)}clearBatchTimer(){this.batchTimer&&(clearInterval(this.batchTimer),this.batchTimer=void 0)}async flushEvents(){if(this.eventBuffer.length===0)return;let e=[...this.eventBuffer];this.eventBuffer=[];let t={userId:this.userId,events:e,metadata:{pageUrl:window.location.href,viewportWidth:screen.width,viewportHeight:screen.height,language:navigator.language}};try{await this.sendBatch(t)}catch{this.eventBuffer.unshift(...e)}}updateUserId(e){e!==this.userId&&(this.eventBuffer.length>0&&this.flushEvents(),this.userId=e)}onPageChange(){this.isRecording&&this.flushEvents()}cleanup(){this.stopRecording()}};var b={automationApi:1,zeroOuterDimensions:2,missingChrome:4,swiftShader:8,emptyPlugins:16,defaultViewport800x600:32,defaultViewport1024x768:64,impossibleDimensions:128,outerDimensionsWeird:256,pluginApiAbsence:512,defaultViewport1280x1200:1024,squareScreen:2048,missingScreenDimensions:4096},tt=Object.keys(b),fe={automationApi:3,zeroOuterDimensions:2,missingChrome:1,swiftShader:1,emptyPlugins:1,defaultViewport800x600:3,defaultViewport1024x768:3,impossibleDimensions:3,outerDimensionsWeird:2,pluginApiAbsence:0,defaultViewport1280x1200:3,squareScreen:3,missingScreenDimensions:1},yt=tt.reduce((n,e)=>n|b[e],0),bt=b.automationApi|b.impossibleDimensions|b.defaultViewport800x600|b.defaultViewport1024x768|b.defaultViewport1280x1200|b.squareScreen,me=10,pe=200,he=8192,rt=[{width:800,height:600,signal:"defaultViewport800x600"},{width:1024,height:768,signal:"defaultViewport1024x768"},{width:1280,height:1200,signal:"defaultViewport1280x1200"}];function nt(n,e){return Number.isFinite(n)&&Number.isFinite(e)&&n>=pe&&e>=pe&&n<=he&&e<=he}function it(n){return/Windows NT|Macintosh|X11|Linux x86_64/.test(n)&&!/Mobile|Android|iPhone|iPad/.test(n)}function ye(n,e,t){if(!nt(n,e))return["impossibleDimensions"];let r=[];if(n===e&&r.push("squareScreen"),it(t))for(let i of rt)n===i.width&&e===i.height&&r.push(i.signal);return r}var be=null;function ke(){return Ee().score}function we(){return Ee().mask}function Se(){return document.prerendering===!0}function Ee(){return Se()?ve():(be??(be=ve()),be)}function ve(){let n=0,e=0;function t(r){let i=b[r];(e&i)===0&&(e|=i,n+=fe[r])}try{let r=navigator.userAgent,i=/Chrome\//.test(r)&&!/\bwv\b|; wv\)/.test(r),s=Number(window.screen?.width),o=Number(window.screen?.height),c=Number(window.outerWidth),d=Number(window.outerHeight),u=Number(window.innerWidth),p=Number(window.innerHeight),R=["__webdriver_evaluate","__selenium_evaluate","__webdriver_script_function","__webdriver_script_func","__webdriver_script_fn","__fxdriver_evaluate","__driver_unwrapped","__webdriver_unwrapped","__driver_evaluate","__selenium_unwrapped","__fxdriver_unwrapped","_phantom","callPhantom","__nightmare","domAutomation","domAutomationController"].some(a=>a in window||a in document);(navigator.webdriver===!0||R)&&t("automationApi"),(d===0||c===0)&&!Se()&&t("zeroOuterDimensions");for(let a of ye(s,o,r))t(a);Number.isFinite(c)&&Number.isFinite(d)&&Number.isFinite(u)&&Number.isFinite(p)&&c>0&&d>0&&u>0&&p>0&&(c+8<u||d+8<p)&&t("outerDimensionsWeird");let h=!1;!window.chrome&&i&&(t("missingChrome"),h=!0);try{let a=document.createElement("canvas"),l=a.getContext("webgl")||a.getContext("experimental-webgl");if(l)try{let g=[],S=l.getParameter(l.RENDERER);typeof S=="string"&&g.push(S);try{let E=l.getExtension("WEBGL_debug_renderer_info");if(E){let C=l.getParameter(E.UNMASKED_RENDERER_WEBGL);typeof C=="string"&&g.push(C)}}catch{}g.join(" ").toLowerCase().includes("swiftshader")&&t("swiftShader")}finally{st(a,l)}}catch{}(!navigator.plugins||navigator.plugins.length===0)&&i&&(t("emptyPlugins"),h=!0),h&&t("pluginApiAbsence")}catch{}return{score:Math.min(n,me),mask:e}}function st(n,e){try{e.getExtension("WEBGL_lose_context")?.loseContext?.()}catch{}n.width=0,n.height=0}var at=2e3,B=class{constructor(e){this.customUserId=null;this.errorDedupeCache=new Map;this.errorDedupeLastCleanup=0;this.exposedFeatureFlags=new Set;this.config=e,this.lastPageviewUrl=this.getPageviewUrl(),this.loadUserId(),e.enableSessionReplay&&this.initializeSessionReplay()}serializeFeatureFlagValue(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return""}}getFeatureFlagEventPayload(){let e={};for(let[t,r]of Object.entries(this.config.featureFlags||{}))e[t]=this.serializeFeatureFlagValue(r.value);return e}getCurrentUrlContext(){let e=new URL(window.location.href),t=_(e,this.config.trackUrlFragments);return{hostname:e.hostname,pathname:t,querystring:e.search,query:Object.fromEntries(e.searchParams.entries()),referrer:document.referrer,language:navigator.language,screenWidth:screen.width,screenHeight:screen.height}}async refreshFeatureFlags(){if(!this.config.featureFlagsEnabled)return;let e=new AbortController,t=window.setTimeout(()=>e.abort(),at);try{let r=await fetch(`${this.config.analyticsHost}/site/${this.config.siteId}/feature-flags/evaluate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({anonymousId:this.config.visitorId,identifiedUserId:this.customUserId||void 0,...this.getCurrentUrlContext()}),mode:"cors",credentials:"omit",keepalive:!0,signal:e.signal});if(!r.ok)return;let i=await r.json();this.config.featureFlags=i?.flags&&typeof i.flags=="object"?i.flags:{},i?.featureFlagsEnabled===!1&&(this.config.featureFlagsEnabled=!1)}catch{}finally{window.clearTimeout(t)}}loadUserId(){try{let e=localStorage.getItem(`${this.config.namespace}-user-id`);e&&(this.customUserId=e)}catch{}}async initializeSessionReplay(){try{this.sessionReplayRecorder=new x(this.config,this.customUserId||"",e=>this.sendSessionReplayBatch(e)),await this.sessionReplayRecorder.initialize()}catch(e){console.error("Failed to initialize session replay:",e)}}async sendSessionReplayBatch(e){try{await fetch(`${this.config.analyticsHost}/session-replay/record/${this.config.siteId}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),mode:"cors",keepalive:!1})}catch(t){throw console.error("Failed to send session replay batch:",t),t}}createBasePayload(){let e=new URL(window.location.href),t=_(e,this.config.trackUrlFragments);if(G(t,this.config.skipPatterns))return null;let r=G(t,this.config.maskPatterns);r&&(t=r);let i={site_id:this.config.siteId,hostname:e.hostname,pathname:t,querystring:this.config.trackQuerystring?e.search:"",screenWidth:screen.width,screenHeight:screen.height,language:navigator.language,page_title:document.title,referrer:document.referrer,_bs:ke(),_bsm:we()};this.customUserId&&(i.user_id=this.customUserId),this.config.tag&&(i.tag=this.config.tag);let s=this.getFeatureFlagEventPayload();return Object.keys(s).length>0&&(i.feature_flags=s),i}async sendTrackingData(e){try{await fetch(`${this.config.analyticsHost}/track`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),mode:"cors",keepalive:!0})}catch(t){console.error("Failed to send tracking data:",t)}}track(e,t="",r={}){if(e==="custom_event"&&(!t||typeof t!="string")){console.error("Event name is required and must be a string for custom events");return}let i=this.createBasePayload();if(!i)return;let o={...i,type:e,event_name:t,properties:["custom_event","outbound","error","button_click","copy","form_submit","input_change"].includes(e)?JSON.stringify(r):void 0};this.sendTrackingData(o)}trackPageview(){this.lastPageviewUrl=this.getPageviewUrl(),this.track("pageview")}trackPageviewIfUrlChanged(){this.getPageviewUrl()!==this.lastPageviewUrl&&this.trackPageview()}getPageviewUrl(){let e=new URL(window.location.href);return JSON.stringify([e.hostname,_(e,this.config.trackUrlFragments),this.config.trackQuerystring?e.search:""])}trackEvent(e,t={}){this.track("custom_event",e,t)}getFeatureFlag(e,t){let r=this.config.featureFlags?.[e];if(!r)return t;let i=`${e}:${r.version}:${this.serializeFeatureFlagValue(r.value)}`;return this.exposedFeatureFlags.has(i)||(this.exposedFeatureFlags.add(i),this.trackEvent("feature_flag_exposure",{key:e,value:this.serializeFeatureFlagValue(r.value),version:r.version,reason:r.reason})),r.value}getFeatureFlags(){return Object.fromEntries(Object.entries(this.config.featureFlags||{}).map(([e,t])=>[e,t.value]))}getFeatureFlagPayload(e,t){let r=this.config.featureFlags?.[e];return!r||r.payload===void 0?t:r.payload}getFeatureFlagPayloads(){return Object.fromEntries(Object.entries(this.config.featureFlags||{}).filter(([,e])=>e.payload!==void 0).map(([e,t])=>[e,t.payload]))}trackOutbound(e,t="",r="_self"){this.track("outbound","",{url:e,text:t,target:r})}trackWebVitals(e){let t=this.createBasePayload();if(!t)return;let r={...t,type:"performance",event_name:"web-vitals",...e};this.sendTrackingData(r)}trackError(e,t={}){let r=e?.message||"";if(r.includes("ResizeObserver loop completed with undelivered notifications")||r.includes("ResizeObserver loop limit exceeded"))return;let i=window.location.origin,s=t.filename||"",o=e.stack||"";if(s)try{if(new URL(s).origin!==i)return}catch{}else if(o&&!o.includes(i))return;let d=[e.name||"Error",r,t.filename||"",t.lineno??"",t.colno??""].join("|"),u=Date.now(),p=6e4,y=this.errorDedupeCache.get(d);if(y&&u-y<p)return;this.errorDedupeCache.set(d,u);let R=10*6e4;if(u-this.errorDedupeLastCleanup>p){for(let[a,l]of this.errorDedupeCache.entries())u-l>R&&this.errorDedupeCache.delete(a);this.errorDedupeLastCleanup=u}let h={message:e.message?.substring(0,500)||"Unknown error",stack:o.substring(0,2e3)||""};if(s&&(h.fileName=s),t.lineno){let a=typeof t.lineno=="string"?parseInt(t.lineno,10):t.lineno;a&&a!==0&&(h.lineNumber=a)}if(t.colno){let a=typeof t.colno=="string"?parseInt(t.colno,10):t.colno;a&&a!==0&&(h.columnNumber=a)}for(let a in t)!["lineno","colno"].includes(a)&&t[a]!==void 0&&(h[a]=t[a]);this.track("error",e.name||"Error",h)}trackButtonClick(e){this.track("button_click","",e)}trackCopy(e){this.track("copy","",e)}trackFormSubmit(e){this.track("form_submit","",e)}trackInputChange(e){this.track("input_change","",e)}identify(e,t){if(typeof e!="string"||e.trim()===""){console.error("User ID must be a non-empty string");return}this.customUserId=e.trim();try{localStorage.setItem(`${this.config.namespace}-user-id`,this.customUserId)}catch{console.warn("Could not persist user ID to localStorage")}this.sendIdentifyEvent(this.customUserId,t,!0).then(()=>this.refreshFeatureFlags()),this.sessionReplayRecorder&&this.sessionReplayRecorder.updateUserId(this.customUserId)}setTraits(e){if(!e||typeof e!="object"){console.error("Traits must be an object");return}let t=this.customUserId;if(!t){console.warn("Cannot set traits without identifying user first. Call identify() first.");return}this.sendIdentifyEvent(t,e,!1).then(()=>this.refreshFeatureFlags())}async sendIdentifyEvent(e,t,r=!0){try{await fetch(`${this.config.analyticsHost}/identify`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({site_id:this.config.siteId,user_id:e,traits:t,is_new_identify:r}),mode:"cors",keepalive:!0})}catch(i){console.error("Failed to send identify event:",i)}}clearUserId(){this.customUserId=null;try{localStorage.removeItem(`${this.config.namespace}-user-id`)}catch{}this.sessionReplayRecorder&&this.sessionReplayRecorder.updateUserId(""),this.refreshFeatureFlags()}getUserId(){return this.customUserId}startSessionReplay(){this.sessionReplayRecorder?this.sessionReplayRecorder.startRecording():console.warn("Session replay not initialized")}stopSessionReplay(){this.sessionReplayRecorder&&this.sessionReplayRecorder.stopRecording()}isSessionReplayActive(){return this.sessionReplayRecorder?.isActive()??!1}onPageChange(){this.refreshFeatureFlags(),this.sessionReplayRecorder&&this.sessionReplayRecorder.onPageChange()}cleanup(){this.sessionReplayRecorder&&this.sessionReplayRecorder.cleanup()}};var Le=-1,F=n=>{addEventListener("pageshow",(e=>{e.persisted&&(Le=e.timeStamp,n(e))}),!0)},v=(n,e,t,r)=>{let i,s;return o=>{e.value>=0&&(o||r)&&(s=e.value-(i??0),(s||i===void 0)&&(i=e.value,e.delta=s,e.rating=((c,d)=>c>d[1]?"poor":c>d[0]?"needs-improvement":"good")(e.value,t),n(e)))}},Z=n=>{requestAnimationFrame((()=>requestAnimationFrame((()=>n()))))},ee=()=>{let n=performance.getEntriesByType("navigation")[0];if(n&&n.responseStart>0&&n.responseStart<performance.now())return n},L=()=>ee()?.activationStart??0,k=(n,e=-1)=>{let t=ee(),r="navigate";return Le>=0?r="back-forward-cache":t&&(document.prerendering||L()>0?r="prerender":document.wasDiscarded?r="restore":t.type&&(r=t.type.replace(/_/g,"-"))),{name:n,value:e,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},z=new WeakMap;function te(n,e){return z.get(n)||z.set(n,new e),z.get(n)}var K=class{constructor(){w(this,"t");w(this,"i",0);w(this,"o",[])}h(e){if(e.hadRecentInput)return;let t=this.o[0],r=this.o.at(-1);this.i&&t&&r&&e.startTime-r.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},M=(n,e,t={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(n)){let r=new PerformanceObserver((i=>{Promise.resolve().then((()=>{e(i.getEntries())}))}));return r.observe({type:n,buffered:!0,...t}),r}}catch{}},re=n=>{let e=!1;return()=>{e||(n(),e=!0)}},A=-1,Me=new Set,Te=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,q=n=>{if(document.visibilityState==="hidden"){if(n.type==="visibilitychange")for(let e of Me)e();isFinite(A)||(A=n.type==="visibilitychange"?n.timeStamp:0,removeEventListener("prerenderingchange",q,!0))}},O=()=>{if(A<0){let n=L();A=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>t.name==="hidden"&&t.startTime>n))[0]?.startTime)??Te(),addEventListener("visibilitychange",q,!0),addEventListener("prerenderingchange",q,!0),F((()=>{setTimeout((()=>{A=Te()}))}))}return{get firstHiddenTime(){return A},onHidden(n){Me.add(n)}}},U=n=>{document.prerendering?addEventListener("prerenderingchange",(()=>n()),!0):n()},Re=[1800,3e3],ne=(n,e={})=>{U((()=>{let t=O(),r,i=k("FCP"),s=M("paint",(o=>{for(let c of o)c.name==="first-contentful-paint"&&(s.disconnect(),c.startTime<t.firstHiddenTime&&(i.value=Math.max(c.startTime-L(),0),i.entries.push(c),r(!0)))}));s&&(r=v(n,i,Re,e.reportAllChanges),F((o=>{i=k("FCP"),r=v(n,i,Re,e.reportAllChanges),Z((()=>{i.value=performance.now()-o.timeStamp,r(!0)}))})))}))},Ce=[.1,.25],xe=(n,e={})=>{let t=O();ne(re((()=>{let r,i=k("CLS",0),s=te(e,K),o=d=>{for(let u of d)s.h(u);s.i>i.value&&(i.value=s.i,i.entries=s.o,r())},c=M("layout-shift",o);c&&(r=v(n,i,Ce,e.reportAllChanges),t.onHidden((()=>{o(c.takeRecords()),r(!0)})),F((()=>{s.i=0,i=k("CLS",0),r=v(n,i,Ce,e.reportAllChanges),Z((()=>r()))})),setTimeout(r))})))},Be=0,$=1/0,N=0,ot=n=>{for(let e of n)e.interactionId&&($=Math.min($,e.interactionId),N=Math.max(N,e.interactionId),Be=N?(N-$)/7+1:0)},J,Ie=()=>J?Be:performance.interactionCount??0,lt=()=>{"interactionCount"in performance||J||(J=M("event",ot,{type:"event",buffered:!0,durationThreshold:0}))},Pe=0,X=class{constructor(){w(this,"u",[]);w(this,"l",new Map);w(this,"m");w(this,"p")}v(){Pe=Ie(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((Ie()-Pe)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&e.entryType!=="first-input")return;let t=this.u.at(-1),r=this.l.get(e.interactionId);if(r||this.u.length<10||e.duration>t.P){if(r?e.duration>r.P?(r.entries=[e],r.P=e.duration):e.duration===r.P&&e.startTime===r.entries[0].startTime&&r.entries.push(e):(r={id:e.interactionId,entries:[e],P:e.duration},this.l.set(r.id,r),this.u.push(r)),this.u.sort(((i,s)=>s.P-i.P)),this.u.length>10){let i=this.u.splice(10);for(let s of i)this.l.delete(s.id)}this.p?.(r)}}},Ne=n=>{let e=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?n():(n=re(n),addEventListener("visibilitychange",n,{once:!0,capture:!0}),e((()=>{n(),removeEventListener("visibilitychange",n,{capture:!0})})))},_e=[200,500],Oe=(n,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let t=O();U((()=>{lt();let r,i=k("INP"),s=te(e,X),o=d=>{Ne((()=>{for(let p of d)s.h(p);let u=s.L();u&&u.P!==i.value&&(i.value=u.P,i.entries=u.entries,r())}))},c=M("event",o,{durationThreshold:e.durationThreshold??40});r=v(n,i,_e,e.reportAllChanges),c&&(c.observe({type:"first-input",buffered:!0}),t.onHidden((()=>{o(c.takeRecords()),r(!0)})),F((()=>{s.v(),i=k("INP"),r=v(n,i,_e,e.reportAllChanges)})))}))},Q=class{constructor(){w(this,"m")}h(e){this.m?.(e)}},Ae=[2500,4e3],Ue=(n,e={})=>{U((()=>{let t=O(),r,i=k("LCP"),s=te(e,Q),o=d=>{e.reportAllChanges||(d=d.slice(-1));for(let u of d)s.h(u),u.startTime<t.firstHiddenTime&&(i.value=Math.max(u.startTime-L(),0),i.entries=[u],r())},c=M("largest-contentful-paint",o);if(c){r=v(n,i,Ae,e.reportAllChanges);let d=re((()=>{o(c.takeRecords()),c.disconnect(),r(!0)})),u=p=>{p.isTrusted&&(Ne(d),removeEventListener(p.type,u,{capture:!0}))};for(let p of["keydown","click","visibilitychange"])addEventListener(p,u,{capture:!0});F((p=>{i=k("LCP"),r=v(n,i,Ae,e.reportAllChanges),Z((()=>{i.value=performance.now()-p.timeStamp,r(!0)}))}))}}))},Fe=[800,1800],Y=n=>{document.prerendering?U((()=>Y(n))):document.readyState!=="complete"?addEventListener("load",(()=>Y(n)),!0):setTimeout(n)},De=(n,e={})=>{let t=k("TTFB"),r=v(n,t,Fe,e.reportAllChanges);Y((()=>{let i=ee();i&&(t.value=Math.max(i.responseStart-L(),0),t.entries=[i],r(!0),F((()=>{t=k("TTFB",0),r=v(n,t,Fe,e.reportAllChanges),r(!0)})))}))};var D=class{constructor(e){this.data={lcp:null,cls:null,inp:null,fcp:null,ttfb:null};this.sent=!1;this.timeout=null;this.onReadyCallback=null;this.onReadyCallback=e}initialize(){try{Ue(this.collectMetric.bind(this)),xe(this.collectMetric.bind(this)),Oe(this.collectMetric.bind(this)),ne(this.collectMetric.bind(this)),De(this.collectMetric.bind(this)),this.timeout=setTimeout(()=>{this.sent||this.sendData()},2e4),window.addEventListener("beforeunload",()=>{this.sent||this.sendData()})}catch(e){console.warn("Error initializing web vitals tracking:",e)}}collectMetric(e){if(this.sent)return;let t=e.name.toLowerCase();this.data[t]=e.value,Object.values(this.data).every(i=>i!==null)&&this.sendData()}sendData(){this.sent||(this.sent=!0,this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.onReadyCallback&&this.onReadyCallback(this.data))}getData(){return{...this.data}}};var ct=1e3,H=class{constructor(e,t){this.lastClickAt=new WeakMap;this.tracker=e,this.config=t}initialize(){document.addEventListener("click",this.handleClick.bind(this),!0)}handleClick(e){let t=e.target;this.config.trackButtonClicks&&this.isButton(t)&&this.trackButtonClick(t)}isButton(e){if(e.tagName==="BUTTON"||e.getAttribute("role")==="button")return!0;if(e.tagName==="INPUT"){let i=e.type?.toLowerCase();if(i==="submit"||i==="button")return!0}let t=e.parentElement,r=0;for(;t&&r<3;){if(t.tagName==="BUTTON"||t.getAttribute("role")==="button")return!0;t=t.parentElement,r++}return!1}trackButtonClick(e){let t=this.findButton(e);if(!t||t.hasAttribute("data-rybbit-event"))return;let r=Date.now(),i=this.lastClickAt.get(t);if(i!==void 0&&r-i<ct)return;this.lastClickAt.set(t,r);let s={text:this.getElementText(t),...this.extractDataAttributes(t)};this.tracker.trackButtonClick(s)}extractDataAttributes(e){let t={};for(let r of e.attributes)if(r.name.startsWith("data-rybbit-prop-")){let i=r.name.replace("data-rybbit-prop-","");t[i]=r.value}return t}findButton(e){if(e.tagName==="BUTTON"||e.getAttribute("role")==="button")return e;if(e.tagName==="INPUT"){let i=e.type?.toLowerCase();if(i==="submit"||i==="button")return e}let t=e.parentElement,r=0;for(;t&&r<3;){if(t.tagName==="BUTTON"||t.getAttribute("role")==="button")return t;t=t.parentElement,r++}return null}getElementText(e){let t=e.textContent?.trim().substring(0,100);if(t)return t;let r=e.getAttribute("aria-label")?.trim().substring(0,100);if(r)return r;if(e.tagName==="INPUT"){let s=e.value?.trim().substring(0,100);if(s)return s}let i=e.getAttribute("title")?.trim().substring(0,100);if(i)return i}cleanup(){document.removeEventListener("click",this.handleClick.bind(this),!0)}};var W=class{constructor(e){this.tracker=e}initialize(){document.addEventListener("copy",this.handleCopy.bind(this))}handleCopy(){let e=window.getSelection();if(!e||e.isCollapsed)return;let t=e.toString(),r=t.length;if(r===0)return;let i=e.anchorNode,s=i instanceof HTMLElement?i:i?.parentElement;if(!s)return;let o={text:t.substring(0,500),...r>500&&{textLength:r},sourceElement:s.tagName.toLowerCase()};this.tracker.trackCopy(o)}cleanup(){document.removeEventListener("copy",this.handleCopy.bind(this))}};var V=class{constructor(e,t){this.tracker=e,this.config=t,this.boundHandleSubmit=this.handleSubmit.bind(this),this.boundHandleChange=this.handleChange.bind(this)}initialize(){document.addEventListener("submit",this.boundHandleSubmit,!0),document.addEventListener("change",this.boundHandleChange,!0)}cleanup(){document.removeEventListener("submit",this.boundHandleSubmit,!0),document.removeEventListener("change",this.boundHandleChange,!0)}handleSubmit(e){let t=e.target;if(t.tagName!=="FORM")return;let r={formId:t.id||"",formName:t.name||"",formAction:t.action||"",method:(t.method||"get").toUpperCase(),fieldCount:t.elements.length,ariaLabel:t.getAttribute("aria-label")||void 0,...this.extractDataAttributes(t)};this.tracker.trackFormSubmit(r)}handleChange(e){let t=e.target;if(!(t instanceof Element))return;let r=t.tagName.toUpperCase();if(!["INPUT","SELECT","TEXTAREA"].includes(r)||t.disabled||t.readOnly)return;if(r==="INPUT"){let o=t.type?.toLowerCase();if(o==="hidden"||o==="password")return}let i=t.name||t.id||t.getAttribute("aria-label")||t.placeholder||"",s={element:r.toLowerCase(),inputType:r==="INPUT"?t.type?.toLowerCase():void 0,inputName:i,formId:t.form?.id||void 0,formName:t.form?.name||void 0,...this.extractDataAttributes(t)};this.tracker.trackInputChange(s)}extractDataAttributes(e){let t={};for(let r of e.attributes)if(r.name.startsWith("data-rybbit-prop-")){let i=r.name.replace("data-rybbit-prop-","");t[i]=r.value}return t}};(async function(){let n=document.currentScript||document.querySelector('script[src*="/script.js"]');if(!n){console.error("Could not find current script tag");return}let e=n.getAttribute("data-namespace")||"rybbit",t=`disable-${e}`;if(window.__RYBBIT_OPTOUT__||localStorage.getItem(t)!==null){window[e]={pageview:()=>{},event:()=>{},error:()=>{},trackOutbound:()=>{},identify:()=>{},setTraits:()=>{},clearUserId:()=>{},getUserId:()=>null,flag:(a,l)=>l,flagPayload:(a,l)=>l,flags:()=>({}),flagPayloads:()=>({}),onReady:()=>{},startSessionReplay:()=>{},stopSessionReplay:()=>{},isSessionReplayActive:()=>!1};return}let r=[],i=a=>(...l)=>{r.push([a,l])};window[e]={pageview:i("pageview"),event:i("event"),error:i("error"),trackOutbound:i("trackOutbound"),identify:i("identify"),setTraits:i("setTraits"),clearUserId:i("clearUserId"),getUserId:()=>null,flag:(a,l)=>l,flagPayload:(a,l)=>l,flags:()=>({}),flagPayloads:()=>({}),onReady:i("onReady"),startSessionReplay:i("startSessionReplay"),stopSessionReplay:i("stopSessionReplay"),isSessionReplayActive:()=>!1};let s=await de(n);if(!s)return;let o=new B(s);s.enableWebVitals&&new D(l=>{o.trackWebVitals(l)}).initialize();let c=null,d=null,u=null;s.trackButtonClicks&&(c=new H(o,s),c.initialize()),s.trackCopy&&(d=new W(o),d.initialize()),s.trackFormInteractions&&(u=new V(o,s),u.initialize()),s.trackErrors&&(window.addEventListener("error",a=>{o.trackError(a.error||new Error(a.message),{filename:a.filename,lineno:a.lineno,colno:a.colno})}),window.addEventListener("unhandledrejection",a=>{let l=a.reason instanceof Error?a.reason:new Error(String(a.reason));o.trackError(l,{type:"unhandledrejection"})}));let p=()=>o.trackPageviewIfUrlChanged(),y=s.debounceDuration>0?ce(p,s.debounceDuration):p;function R(){if(document.addEventListener("click",function(a){let l=a.target;for(;l&&l!==document.documentElement;){if(l.hasAttribute("data-rybbit-event")){let g=l.getAttribute("data-rybbit-event");if(g){let S={};for(let E of l.attributes)if(E.name.startsWith("data-rybbit-prop-")){let C=E.name.replace("data-rybbit-prop-","");S[C]=E.value}o.trackEvent(g,S)}break}l=l.parentElement}if(s.trackOutbound){let g=a.target.closest("a");g?.href&&ue(g.href)&&o.trackOutbound(g.href,g.innerText||g.textContent||"",g.target||"_self")}}),s.autoTrackSpa){let a=history.pushState,l=history.replaceState;history.pushState=function(...g){a.apply(this,g),y(),o.onPageChange()},history.replaceState=function(...g){l.apply(this,g),y(),o.onPageChange()},window.addEventListener("popstate",()=>{y(),o.onPageChange()}),window.addEventListener("hashchange",()=>{y(),o.onPageChange()})}}window[s.namespace]={pageview:()=>o.trackPageview(),event:(a,l={})=>o.trackEvent(a,l),error:(a,l={})=>o.trackError(a,l),trackOutbound:(a,l="",g="_self")=>o.trackOutbound(a,l,g),identify:(a,l)=>o.identify(a,l),setTraits:a=>o.setTraits(a),clearUserId:()=>o.clearUserId(),getUserId:()=>o.getUserId(),flag:(a,l)=>o.getFeatureFlag(a,l),flagPayload:(a,l)=>o.getFeatureFlagPayload(a,l),flags:()=>o.getFeatureFlags(),flagPayloads:()=>o.getFeatureFlagPayloads(),onReady:a=>a(window[s.namespace]),startSessionReplay:()=>o.startSessionReplay(),stopSessionReplay:()=>o.stopSessionReplay(),isSessionReplayActive:()=>o.isSessionReplayActive()};let h=window[s.namespace];for(let[a,l]of r)h[a](...l);R(),window.addEventListener("beforeunload",()=>{c?.cleanup(),d?.cleanup(),o.cleanup()}),s.autoTrackPageview&&o.trackPageview()})();})();
diff --git a/server/src/analytics-script/config.test.ts b/server/src/analytics-script/config.test.ts
index e918a6744..663ca38c9 100644
--- a/server/src/analytics-script/config.test.ts
+++ b/server/src/analytics-script/config.test.ts
@@ -37,6 +37,7 @@ describe("parseScriptConfig", () => {
trackErrors: false,
trackOutbound: true,
trackUrlParams: false,
+ trackUrlFragments: true,
trackInitialPageView: true,
trackSpaNavigation: false,
}),
@@ -69,6 +70,7 @@ describe("parseScriptConfig", () => {
autoTrackPageview: true, // trackInitialPageView from API
autoTrackSpa: false, // trackSpaNavigation from API
trackQuerystring: false, // trackUrlParams from API
+ trackUrlFragments: true,
trackOutbound: true, // trackOutbound from API
enableWebVitals: true, // webVitals from API
trackErrors: false, // trackErrors from API
@@ -130,6 +132,31 @@ describe("parseScriptConfig", () => {
expect(config?.featureFlags).toEqual({});
});
+ it("evaluates feature flags using opted-in checkout fragments", async () => {
+ const originalLocation = Object.getOwnPropertyDescriptor(window, "location");
+ Object.defineProperty(window, "location", {
+ configurable: true,
+ value: { href: "https://example.com/checkout/#shipping" },
+ });
+ try {
+ mockScriptTag.setAttribute("src", "https://analytics.example.com/script.js");
+ mockScriptTag.setAttribute("data-site-id", "123");
+ vi.mocked(fetch)
+ .mockResolvedValueOnce({
+ ok: true,
+ json: async () => ({ featureFlagsEnabled: true, trackUrlFragments: true }),
+ } as Response)
+ .mockResolvedValueOnce({ ok: true, json: async () => ({ flags: {} }) } as Response);
+
+ await parseScriptConfig(mockScriptTag);
+
+ const body = JSON.parse(vi.mocked(fetch).mock.calls[1][1]!.body as string);
+ expect(body.pathname).toBe("/checkout/#shipping");
+ } finally {
+ if (originalLocation) Object.defineProperty(window, "location", originalLocation);
+ }
+ });
+
it("stops future evaluation when flags are deleted between configuration and evaluation", async () => {
mockScriptTag.setAttribute("src", "https://analytics.example.com/script.js");
mockScriptTag.setAttribute("data-site-id", "123");
@@ -172,6 +199,7 @@ describe("parseScriptConfig", () => {
autoTrackPageview: true,
autoTrackSpa: true,
trackQuerystring: true,
+ trackUrlFragments: false,
trackOutbound: true,
enableWebVitals: false,
trackErrors: false,
@@ -221,6 +249,7 @@ describe("parseScriptConfig", () => {
autoTrackPageview: true,
autoTrackSpa: true,
trackQuerystring: true,
+ trackUrlFragments: false,
trackOutbound: true,
enableWebVitals: false,
trackErrors: false,
diff --git a/server/src/analytics-script/config.ts b/server/src/analytics-script/config.ts
index 0c3d1ce5b..85171297f 100644
--- a/server/src/analytics-script/config.ts
+++ b/server/src/analytics-script/config.ts
@@ -1,5 +1,6 @@
import { ScriptConfig } from "./types.js";
import { parseJsonSafely } from "./utils.js";
+import { getTrackedPathname } from "./url.js";
const FEATURE_FLAG_REQUEST_TIMEOUT_MS = 2000;
@@ -43,19 +44,12 @@ function getIdentifiedUserId(namespace: string): string | undefined {
}
}
-function getEvaluationPathname(url: URL): string {
- if (url.hash && url.hash.startsWith("#/")) {
- return url.hash.substring(1);
- }
-
- return url.pathname;
-}
-
async function fetchFeatureFlags(
analyticsHost: string,
siteId: string,
namespace: string,
- visitorId: string
+ visitorId: string,
+ trackUrlFragments: boolean
): Promise<FeatureFlagFetchResult> {
const controller = new AbortController();
const timeout = window.setTimeout(() => controller.abort(), FEATURE_FLAG_REQUEST_TIMEOUT_MS);
@@ -73,7 +67,7 @@ async function fetchFeatureFlags(
anonymousId: visitorId,
identifiedUserId: getIdentifiedUserId(namespace),
hostname: url.hostname,
- pathname: getEvaluationPathname(url),
+ pathname: getTrackedPathname(url, trackUrlFragments),
querystring: url.search,
query: Object.fromEntries(url.searchParams.entries()),
referrer: document.referrer,
@@ -129,8 +123,7 @@ export async function parseScriptConfig(scriptTag: HTMLScriptElement): Promise<S
// optimizers such as WP Rocket, Perfmatters, and FlyingPress recreate the
// tag from `data-src` and drop every other `data-*` attribute, but they keep
// the URL intact. The attributes remain supported for existing installs.
- const siteId =
- getSiteIdFromSrc(src) || scriptTag.getAttribute("data-site-id") || scriptTag.getAttribute("site-id");
+ const siteId = getSiteIdFromSrc(src) || scriptTag.getAttribute("data-site-id") || scriptTag.getAttribute("site-id");
if (!siteId) {
console.error("Please provide a valid site ID using the ?siteId= query parameter or the data-site-id attribute");
return null;
@@ -208,6 +201,7 @@ export async function parseScriptConfig(scriptTag: HTMLScriptElement): Promise<S
autoTrackPageview: true,
autoTrackSpa: true,
trackQuerystring: true,
+ trackUrlFragments: false,
trackOutbound: true,
enableWebVitals: false,
trackErrors: false,
@@ -253,6 +247,7 @@ export async function parseScriptConfig(scriptTag: HTMLScriptElement): Promise<S
autoTrackPageview: apiConfig.trackInitialPageView ?? defaultConfig.autoTrackPageview,
autoTrackSpa: apiConfig.trackSpaNavigation ?? defaultConfig.autoTrackSpa,
trackQuerystring: apiConfig.trackUrlParams ?? defaultConfig.trackQuerystring,
+ trackUrlFragments: apiConfig.trackUrlFragments ?? defaultConfig.trackUrlFragments,
trackOutbound: apiConfig.trackOutbound ?? defaultConfig.trackOutbound,
enableWebVitals: apiConfig.webVitals ?? defaultConfig.enableWebVitals,
trackErrors: apiConfig.trackErrors ?? defaultConfig.trackErrors,
@@ -274,7 +269,13 @@ export async function parseScriptConfig(scriptTag: HTMLScriptElement): Promise<S
if (resolvedConfig.featureFlagsEnabled) {
// Percentage rollouts bucket on this ID, so persist it across page loads.
resolvedConfig.visitorId = getOrCreateVisitorId(namespace);
- const result = await fetchFeatureFlags(analyticsHost, siteId, namespace, resolvedConfig.visitorId);
+ const result = await fetchFeatureFlags(
+ analyticsHost,
+ siteId,
+ namespace,
+ resolvedConfig.visitorId,
+ resolvedConfig.trackUrlFragments
+ );
resolvedConfig.featureFlagsEnabled = result.enabled;
resolvedConfig.featureFlags = result.flags;
}
diff --git a/server/src/analytics-script/index.test.ts b/server/src/analytics-script/index.test.ts
new file mode 100644
index 000000000..3ca7728af
--- /dev/null
+++ b/server/src/analytics-script/index.test.ts
@@ -0,0 +1,165 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import type { ScriptConfig } from "./types.js";
+
+const mocks = vi.hoisted(() => ({ parseScriptConfig: vi.fn() }));
+vi.mock("./config.js", () => ({ parseScriptConfig: mocks.parseScriptConfig }));
+
+describe("automatic navigation tracking", () => {
+ let config: ScriptConfig;
+ let location: { href: string };
+ let originalLocation: PropertyDescriptor | undefined;
+ let originalPushState: History["pushState"];
+ let originalReplaceState: History["replaceState"];
+ let windowListeners: ReturnType<typeof vi.spyOn>;
+ let documentListeners: ReturnType<typeof vi.spyOn>;
+
+ beforeEach(() => {
+ vi.resetModules();
+ vi.useFakeTimers();
+ originalLocation = Object.getOwnPropertyDescriptor(window, "location");
+ location = { href: "https://example.com/checkout/" };
+ Object.defineProperty(window, "location", { configurable: true, value: location });
+ originalPushState = history.pushState;
+ originalReplaceState = history.replaceState;
+ const navigate = (_data: unknown, _unused: string, url?: string | URL | null) => {
+ if (url != null) location.href = new URL(String(url), location.href).href;
+ };
+ history.pushState = navigate;
+ history.replaceState = navigate;
+ windowListeners = vi.spyOn(window, "addEventListener");
+ documentListeners = vi.spyOn(document, "addEventListener");
+ vi.spyOn(HTMLCanvasElement.prototype, "getContext").mockReturnValue(null);
+ vi.stubGlobal("fetch", vi.fn().mockResolvedValue({ ok: true }));
+ localStorage.clear();
+ document.body.innerHTML = '<script src="https://analytics.example.com/script.js"></script>';
+ config = {
+ namespace: "rybbit",
+ analyticsHost: "https://analytics.example.com",
+ siteId: "17571",
+ visitorId: "visitor",
+ debounceDuration: 500,
+ autoTrackPageview: true,
+ autoTrackSpa: true,
+ trackQuerystring: true,
+ trackUrlFragments: false,
+ trackOutbound: false,
+ enableWebVitals: false,
+ trackErrors: false,
+ enableSessionReplay: false,
+ sessionReplayBatchSize: 250,
+ sessionReplayBatchInterval: 5000,
+ sessionReplayMaskTextSelectors: [],
+ skipPatterns: [],
+ maskPatterns: [],
+ trackButtonClicks: false,
+ trackCopy: false,
+ trackFormInteractions: false,
+ tag: "",
+ featureFlagsEnabled: false,
+ featureFlags: {},
+ };
+ mocks.parseScriptConfig.mockImplementation(async () => config);
+ });
+
+ afterEach(() => {
+ window.dispatchEvent(new Event("beforeunload"));
+ for (const [type, listener, options] of windowListeners.mock.calls) {
+ window.removeEventListener(type as string, listener as EventListener, options as boolean);
+ }
+ for (const [type, listener, options] of documentListeners.mock.calls) {
+ document.removeEventListener(type as string, listener as EventListener, options as boolean);
+ }
+ history.pushState = originalPushState;
+ history.replaceState = originalReplaceState;
+ if (originalLocation) Object.defineProperty(window, "location", originalLocation);
+ delete (window as Partial<Window>).rybbit;
+ vi.restoreAllMocks();
+ vi.unstubAllGlobals();
+ vi.useRealTimers();
+ });
+
+ async function start() {
+ await import("./index.js");
+ await vi.advanceTimersByTimeAsync(0);
+ }
+
+ function pageviews() {
+ return vi.mocked(fetch).mock.calls.map(([, init]) => JSON.parse(init!.body as string));
+ }
+
+ async function changeHash(hash: string) {
+ const url = new URL(location.href);
+ url.hash = hash;
+ location.href = url.href;
+ window.dispatchEvent(new Event("hashchange"));
+ await vi.advanceTimersByTimeAsync(500);
+ }
+
+ it("ignores ordinary anchor changes and same-URL History API updates", async () => {
+ await start();
+ await changeHash("#shipping");
+ history.replaceState({}, "", location.href);
+ await vi.advanceTimersByTimeAsync(500);
+ await changeHash("#payment");
+ expect(pageviews().map(event => event.pathname)).toEqual(["/checkout/"]);
+ });
+
+ it("records checkout fragments separately when enabled, including returning to the base path", async () => {
+ config.trackUrlFragments = true;
+ location.href += "#shipping";
+ await start();
+ await changeHash("#payment");
+ await changeHash("");
+ expect(pageviews().map(event => event.pathname)).toEqual([
+ "/checkout/#shipping",
+ "/checkout/#payment",
+ "/checkout/",
+ ]);
+ });
+
+ it("tracks slash-prefixed and hashbang routes automatically", async () => {
+ await start();
+ await changeHash("#/shipping");
+ await changeHash("#!/payment");
+ expect(pageviews().map(event => event.pathname)).toEqual(["/checkout/", "/shipping", "/payment"]);
+ });
+
+ it("records one pageview when popstate and hashchange describe the same navigation", async () => {
+ config.debounceDuration = 0;
+ await start();
+ location.href += "#/shipping";
+ window.dispatchEvent(new Event("popstate"));
+ window.dispatchEvent(new Event("hashchange"));
+ expect(pageviews().map(event => event.pathname)).toEqual(["/checkout/", "/shipping"]);
+ });
+
+ it("honors URL parameter tracking when deciding whether navigation changed", async () => {
+ config.trackQuerystring = false;
+ await start();
+ history.pushState({}, "", "/checkout/?utm_source=test");
+ await vi.advanceTimersByTimeAsync(500);
+ expect(pageviews()).toHaveLength(1);
+ config.trackQuerystring = true;
+ history.pushState({}, "", "/checkout/?utm_source=other");
+ await vi.advanceTimersByTimeAsync(500);
+ expect(pageviews().map(event => event.querystring)).toEqual(["", "?utm_source=other"]);
+ });
+
+ it("allows explicit pageviews of an unchanged URL", async () => {
+ await start();
+ window.rybbit.pageview();
+ window.rybbit.pageview();
+ await changeHash("#shipping");
+ expect(pageviews()).toHaveLength(3);
+ });
+
+ it("ignores anchors with initial tracking disabled and still tracks subsequent routes", async () => {
+ config.autoTrackPageview = false;
+ await start();
+ await changeHash("#shipping");
+ expect(pageviews()).toHaveLength(0);
+ history.pushState({}, "", "/order/success/");
+ await vi.advanceTimersByTimeAsync(500);
+ expect(pageviews().map(event => event.pathname)).toEqual(["/order/success/"]);
+ });
+});
diff --git a/server/src/analytics-script/index.ts b/server/src/analytics-script/index.ts
index 46e5c7ba7..12e5f8909 100644
--- a/server/src/analytics-script/index.ts
+++ b/server/src/analytics-script/index.ts
@@ -143,7 +143,7 @@ declare global {
}
// Create debounced pageview tracker
- const trackPageview = () => tracker.trackPageview();
+ const trackPageview = () => tracker.trackPageviewIfUrlChanged();
const debouncedTrackPageview =
config!.debounceDuration > 0 ? debounce(trackPageview, config!.debounceDuration) : trackPageview;
diff --git a/server/src/analytics-script/sessionReplay.test.ts b/server/src/analytics-script/sessionReplay.test.ts
index 2b1fc2a5c..551a7dd36 100644
--- a/server/src/analytics-script/sessionReplay.test.ts
+++ b/server/src/analytics-script/sessionReplay.test.ts
@@ -11,6 +11,7 @@ const config: ScriptConfig = {
autoTrackPageview: true,
autoTrackSpa: true,
trackQuerystring: true,
+ trackUrlFragments: false,
trackOutbound: true,
enableWebVitals: false,
trackErrors: false,
diff --git a/server/src/analytics-script/tracking.test.ts b/server/src/analytics-script/tracking.test.ts
index 73989fcde..c4c16568e 100644
--- a/server/src/analytics-script/tracking.test.ts
+++ b/server/src/analytics-script/tracking.test.ts
@@ -92,6 +92,7 @@ describe("Tracker", () => {
autoTrackPageview: true,
autoTrackSpa: true,
trackQuerystring: true,
+ trackUrlFragments: false,
trackOutbound: true,
trackErrors: false,
enableWebVitals: false,
@@ -141,6 +142,27 @@ describe("Tracker", () => {
expect(payload?.pathname).toBe("/dashboard/users");
});
+ it("handles hashbang routes without changing slash-prefixed hash routes", () => {
+ mockLocation.hash = "#!/shipping";
+ expect(tracker.createBasePayload()?.pathname).toBe("/shipping");
+ });
+
+ it("ignores ordinary fragments by default", () => {
+ mockLocation.pathname = "/checkout/";
+ mockLocation.hash = "#shipping";
+ expect(tracker.createBasePayload()?.pathname).toBe("/checkout/");
+ });
+
+ it("preserves checkout stages when URL fragment tracking is enabled", () => {
+ config.trackUrlFragments = true;
+ tracker = new Tracker(config);
+ mockLocation.pathname = "/checkout/";
+ mockLocation.hash = "#shipping";
+ expect(tracker.createBasePayload()?.pathname).toBe("/checkout/#shipping");
+ mockLocation.hash = "#payment";
+ expect(tracker.createBasePayload()?.pathname).toBe("/checkout/#payment");
+ });
+
it("should skip tracking for matching skip patterns", () => {
config.skipPatterns = ["/admin/**", "/api/**"];
tracker = new Tracker(config);
diff --git a/server/src/analytics-script/tracking.ts b/server/src/analytics-script/tracking.ts
index d602c410f..7b44e9742 100644
--- a/server/src/analytics-script/tracking.ts
+++ b/server/src/analytics-script/tracking.ts
@@ -12,6 +12,7 @@ import {
import { findMatchingPattern } from "./utils.js";
import { SessionReplayRecorder } from "./sessionReplay.js";
import { getBotScore, getBotSignalMask } from "./botSignals.js";
+import { getTrackedPathname } from "./url.js";
const FEATURE_FLAG_REQUEST_TIMEOUT_MS = 2000;
@@ -22,8 +23,10 @@ export class Tracker {
private errorDedupeCache: Map<string, number> = new Map();
private errorDedupeLastCleanup = 0;
private exposedFeatureFlags = new Set<string>();
+ private lastPageviewUrl: string;
constructor(config: ScriptConfig) {
this.config = config;
+ this.lastPageviewUrl = this.getPageviewUrl();
this.loadUserId();
if (config.enableSessionReplay) {
@@ -55,7 +58,7 @@ export class Tracker {
private getCurrentUrlContext() {
const url = new URL(window.location.href);
- const pathname = url.hash && url.hash.startsWith("#/") ? url.hash.substring(1) : url.pathname;
+ const pathname = getTrackedPathname(url, this.config.trackUrlFragments);
return {
hostname: url.hostname,
@@ -146,12 +149,7 @@ export class Tracker {
createBasePayload(): BasePayload | null {
const url = new URL(window.location.href);
- let pathname = url.pathname;
-
- // Handle hash-based SPA routing
- if (url.hash && url.hash.startsWith("#/")) {
- pathname = url.hash.substring(1);
- }
+ let pathname = getTrackedPathname(url, this.config.trackUrlFragments);
// Check skip patterns
if (findMatchingPattern(pathname, this.config.skipPatterns)) {
@@ -241,9 +239,25 @@ export class Tracker {
}
trackPageview(): void {
+ this.lastPageviewUrl = this.getPageviewUrl();
this.track("pageview");
}
+ trackPageviewIfUrlChanged(): void {
+ if (this.getPageviewUrl() !== this.lastPageviewUrl) {
+ this.trackPageview();
+ }
+ }
+
+ private getPageviewUrl(): string {
+ const url = new URL(window.location.href);
+ return JSON.stringify([
+ url.hostname,
+ getTrackedPathname(url, this.config.trackUrlFragments),
+ this.config.trackQuerystring ? url.search : "",
+ ]);
+ }
+
trackEvent(name: string, properties: Record<string, any> = {}): void {
this.track("custom_event", name, properties);
}
diff --git a/server/src/analytics-script/types.ts b/server/src/analytics-script/types.ts
index 94bdb46ae..1af59d089 100644
--- a/server/src/analytics-script/types.ts
+++ b/server/src/analytics-script/types.ts
@@ -7,6 +7,7 @@ export interface ScriptConfig {
autoTrackPageview: boolean;
autoTrackSpa: boolean;
trackQuerystring: boolean;
+ trackUrlFragments: boolean;
trackOutbound: boolean;
enableWebVitals: boolean;
trackErrors: boolean;
diff --git a/server/src/analytics-script/url.ts b/server/src/analytics-script/url.ts
new file mode 100644
index 000000000..58d6e0726
--- /dev/null
+++ b/server/src/analytics-script/url.ts
@@ -0,0 +1,9 @@
+export function getTrackedPathname(url: URL, trackUrlFragments = false): string {
+ if (url.hash.startsWith("#/")) {
+ return url.hash.substring(1);
+ }
+ if (url.hash.startsWith("#!/")) {
+ return url.hash.substring(2);
+ }
+ return url.pathname + (trackUrlFragments ? url.hash : "");
+}
diff --git a/server/src/api/sites/getSite.ts b/server/src/api/sites/getSite.ts
index fa5ef1f69..85a2638a5 100644
--- a/server/src/api/sites/getSite.ts
+++ b/server/src/api/sites/getSite.ts
@@ -77,6 +77,7 @@ export async function getSite(request: FastifyRequest<GetSiteParams>, reply: Fas
trackErrors: site.trackErrors,
trackOutbound: site.trackOutbound,
trackUrlParams: site.trackUrlParams,
+ trackUrlFragments: site.trackUrlFragments,
trackInitialPageView: site.trackInitialPageView,
trackSpaNavigation: site.trackSpaNavigation,
trackButtonClicks: site.trackButtonClicks,
diff --git a/server/src/api/sites/getTrackingConfig.test.ts b/server/src/api/sites/getTrackingConfig.test.ts
index cc216f039..229b52d0e 100644
--- a/server/src/api/sites/getTrackingConfig.test.ts
+++ b/server/src/api/sites/getTrackingConfig.test.ts
@@ -31,6 +31,7 @@ describe("getTrackingConfig", () => {
trackErrors: false,
trackOutbound: true,
trackUrlParams: true,
+ trackUrlFragments: false,
trackInitialPageView: true,
trackSpaNavigation: true,
trackButtonClicks: false,
@@ -50,4 +51,17 @@ describe("getTrackingConfig", () => {
expect(mocks.hasFeatureFlagsForRuntime).toHaveBeenCalledWith(123, "client");
expect(reply.send).toHaveBeenCalledWith(expect.objectContaining({ featureFlagsEnabled: false }));
});
+
+ it.each([true, false])("returns URL fragment tracking set to %s", async enabled => {
+ mocks.getConfig.mockResolvedValue({
+ ...(await mocks.getConfig()),
+ trackUrlFragments: enabled,
+ });
+ const request = { params: { siteId: "123" }, log: { error: vi.fn() } } as any;
+ const reply = { send: vi.fn(), status: vi.fn().mockReturnThis() } as any;
+
+ await getTrackingConfig(request, reply);
+
+ expect(reply.send).toHaveBeenCalledWith(expect.objectContaining({ trackUrlFragments: enabled }));
+ });
});
diff --git a/server/src/api/sites/getTrackingConfig.ts b/server/src/api/sites/getTrackingConfig.ts
index 4de1ef895..1f7143b61 100644
--- a/server/src/api/sites/getTrackingConfig.ts
+++ b/server/src/api/sites/getTrackingConfig.ts
@@ -31,6 +31,7 @@ export async function getTrackingConfig(request: FastifyRequest<{ Params: { site
trackErrors: config.trackErrors,
trackOutbound: config.trackOutbound,
trackUrlParams: config.trackUrlParams,
+ trackUrlFragments: config.trackUrlFragments,
trackInitialPageView: config.trackInitialPageView,
trackSpaNavigation: config.trackSpaNavigation,
trackButtonClicks: config.trackButtonClicks,
diff --git a/server/src/api/sites/updateSiteConfig.test.ts b/server/src/api/sites/updateSiteConfig.test.ts
index 32e2fd6f4..4cd128ea3 100644
--- a/server/src/api/sites/updateSiteConfig.test.ts
+++ b/server/src/api/sites/updateSiteConfig.test.ts
@@ -198,6 +198,7 @@ describe("updateSiteConfig — non-gated fields update without subscription chec
blockBots: false,
webVitals: true,
trackErrors: true,
+ trackUrlFragments: true,
excludedCountries: ["US", "GB"],
tags: ["prod"],
}),
@@ -212,6 +213,7 @@ describe("updateSiteConfig — non-gated fields update without subscription chec
blockBots: false,
webVitals: true,
trackErrors: true,
+ trackUrlFragments: true,
excludedCountries: ["US", "GB"],
tags: ["prod"],
});
diff --git a/server/src/api/sites/updateSiteConfig.ts b/server/src/api/sites/updateSiteConfig.ts
index 1dabb96ee..5969878a2 100644
--- a/server/src/api/sites/updateSiteConfig.ts
+++ b/server/src/api/sites/updateSiteConfig.ts
@@ -56,6 +56,7 @@ const updateSiteConfigSchema = z.object({
trackErrors: z.boolean().optional(),
trackOutbound: z.boolean().optional(),
trackUrlParams: z.boolean().optional(),
+ trackUrlFragments: z.boolean().optional(),
trackInitialPageView: z.boolean().optional(),
trackSpaNavigation: z.boolean().optional(),
trackIp: z.boolean().optional(),
diff --git a/server/src/db/postgres/schema.ts b/server/src/db/postgres/schema.ts
index a0fa79f7f..910f93070 100644
--- a/server/src/db/postgres/schema.ts
+++ b/server/src/db/postgres/schema.ts
@@ -94,6 +94,7 @@ export const sites = pgTable(
trackErrors: boolean().default(false),
trackOutbound: boolean().default(true),
trackUrlParams: boolean().default(true),
+ trackUrlFragments: boolean().default(false),
trackInitialPageView: boolean().default(true),
trackSpaNavigation: boolean().default(true),
trackIp: boolean().default(false),
diff --git a/server/src/db/postgres/trackUrlFragmentsMigration.test.ts b/server/src/db/postgres/trackUrlFragmentsMigration.test.ts
new file mode 100644
index 000000000..c364b936a
--- /dev/null
+++ b/server/src/db/postgres/trackUrlFragmentsMigration.test.ts
@@ -0,0 +1,27 @@
+import { readFile } from "node:fs/promises";
+import { PGlite } from "@electric-sql/pglite";
+import { expect, it } from "vitest";
+
+it("can rerun the URL fragment migration without resetting saved settings", async () => {
+ const database = new PGlite();
+ try {
+ await database.exec("CREATE TABLE sites (site_id integer PRIMARY KEY); INSERT INTO sites VALUES (1);");
+ const migration = await readFile(new URL("../../../drizzle/0023_track_url_fragments.sql", import.meta.url), "utf8");
+
+ await database.exec(migration);
+ expect((await database.query('SELECT "trackUrlFragments" FROM sites')).rows).toEqual([
+ { trackUrlFragments: false },
+ ]);
+
+ await database.exec('UPDATE sites SET "trackUrlFragments" = true WHERE site_id = 1;');
+ await database.exec(migration);
+ await database.exec("INSERT INTO sites (site_id) VALUES (2);");
+
+ expect((await database.query('SELECT site_id, "trackUrlFragments" FROM sites ORDER BY site_id')).rows).toEqual([
+ { site_id: 1, trackUrlFragments: true },
+ { site_id: 2, trackUrlFragments: false },
+ ]);
+ } finally {
+ await database.close();
+ }
+});
diff --git a/server/src/lib/auth-utils.test.ts b/server/src/lib/auth-utils.test.ts
index 157800dbb..4fc3aecfb 100644
--- a/server/src/lib/auth-utils.test.ts
+++ b/server/src/lib/auth-utils.test.ts
@@ -141,6 +141,7 @@ CREATE TABLE "sites" (
"trackErrors" boolean DEFAULT false,
"trackOutbound" boolean DEFAULT true,
"trackUrlParams" boolean DEFAULT true,
+ "trackUrlFragments" boolean DEFAULT false,
"trackInitialPageView" boolean DEFAULT true,
"trackSpaNavigation" boolean DEFAULT true,
"trackIp" boolean DEFAULT false,
diff --git a/server/src/lib/siteConfig.test.ts b/server/src/lib/siteConfig.test.ts
index 75a7dd94c..0c418eb63 100644
--- a/server/src/lib/siteConfig.test.ts
+++ b/server/src/lib/siteConfig.test.ts
@@ -22,6 +22,7 @@ type SiteRow = {
trackErrors: boolean | null;
trackOutbound: boolean | null;
trackUrlParams: boolean | null;
+ trackUrlFragments: boolean | null;
trackInitialPageView: boolean | null;
trackSpaNavigation: boolean | null;
trackIp: boolean | null;
@@ -72,6 +73,7 @@ function createSiteRow(overrides: Partial<SiteRow>): SiteRow {
trackErrors: false,
trackOutbound: true,
trackUrlParams: true,
+ trackUrlFragments: false,
trackInitialPageView: true,
trackSpaNavigation: true,
trackIp: false,
@@ -132,6 +134,12 @@ beforeEach(() => {
});
describe("siteConfig.getConfig", () => {
+ it.each([true, false, null])("defaults or preserves URL fragment tracking set to %s", async value => {
+ dbMock.rows.push(createSiteRow({ trackUrlFragments: value }));
+ const config = await siteConfig.getConfig(123);
+ expect(config?.trackUrlFragments).toBe(value ?? false);
+ });
+
it("resolves digit-only string site IDs by exact sites.id before legacy site_id fallback", async () => {
dbMock.rows.push(
createSiteRow({
diff --git a/server/src/lib/siteConfig.ts b/server/src/lib/siteConfig.ts
index 0e9296324..5abd3eabd 100644
--- a/server/src/lib/siteConfig.ts
+++ b/server/src/lib/siteConfig.ts
@@ -29,6 +29,7 @@ export interface SiteConfigData {
trackErrors: boolean;
trackOutbound: boolean;
trackUrlParams: boolean;
+ trackUrlFragments: boolean;
trackInitialPageView: boolean;
trackSpaNavigation: boolean;
trackIp: boolean;
@@ -126,6 +127,7 @@ class SiteConfig {
trackErrors: site.trackErrors || false,
trackOutbound: site.trackOutbound ?? true,
trackUrlParams: site.trackUrlParams ?? true,
+ trackUrlFragments: site.trackUrlFragments ?? false,
trackInitialPageView: site.trackInitialPageView ?? true,
trackSpaNavigation: site.trackSpaNavigation ?? true,
trackIp: site.trackIp || false,
diff --git a/server/src/mcp/inputs.ts b/server/src/mcp/inputs.ts
index 3d581cb07..d982d92bf 100644
--- a/server/src/mcp/inputs.ts
+++ b/server/src/mcp/inputs.ts
@@ -243,6 +243,7 @@ export const siteFeatureInputs = {
trackErrors: z.boolean().optional().describe("Capture JavaScript errors"),
trackOutbound: z.boolean().optional().describe("Track outbound link clicks"),
trackUrlParams: z.boolean().optional().describe("Keep URL query parameters in analytics"),
+ trackUrlFragments: z.boolean().optional().describe("Keep ordinary URL fragments such as #shipping in tracked paths"),
trackInitialPageView: z.boolean().optional(),
trackSpaNavigation: z.boolean().optional(),
trackIp: z.boolean().optional().describe("Store visitor IP addresses"),
diff --git a/server/src/services/sites/siteConfigurationLifecycle.test.ts b/server/src/services/sites/siteConfigurationLifecycle.test.ts
index cde277bee..809894dc1 100644
--- a/server/src/services/sites/siteConfigurationLifecycle.test.ts
+++ b/server/src/services/sites/siteConfigurationLifecycle.test.ts
@@ -74,6 +74,13 @@ beforeEach(() => {
});
describe("siteConfigurationLifecycle", () => {
+ it.each([true, false])("persists URL fragment tracking set to %s and invalidates the cache", async enabled => {
+ await siteConfigurationLifecycle.update(1, { trackUrlFragments: enabled });
+
+ expect(state.updates).toEqual([expect.objectContaining({ trackUrlFragments: enabled })]);
+ expect(mocks.invalidate).toHaveBeenCalledWith(state.site);
+ });
+
it("updates persistence once, invalidates the Site, and reloads its configuration", async () => {
const result = await siteConfigurationLifecycle.update(1, { name: "Renamed" });
diff --git a/server/src/services/sites/siteConfigurationLifecycle.ts b/server/src/services/sites/siteConfigurationLifecycle.ts
index da411e735..c1666fa73 100644
--- a/server/src/services/sites/siteConfigurationLifecycle.ts
+++ b/server/src/services/sites/siteConfigurationLifecycle.ts
@@ -33,6 +33,7 @@ export type CreateSiteInput = {
trackErrors?: boolean;
trackOutbound?: boolean;
trackUrlParams?: boolean;
+ trackUrlFragments?: boolean;
trackInitialPageView?: boolean;
trackSpaNavigation?: boolean;
trackIp?: boolean;
@@ -64,6 +65,7 @@ export type UpdateSiteConfigurationInput = {
trackErrors?: boolean;
trackOutbound?: boolean;
trackUrlParams?: boolean;
+ trackUrlFragments?: boolean;
trackInitialPageView?: boolean;
trackSpaNavigation?: boolean;
trackIp?: boolean;
@@ -130,6 +132,7 @@ const DIRECT_UPDATE_FIELDS = [
"trackErrors",
"trackOutbound",
"trackUrlParams",
+ "trackUrlFragments",
"trackInitialPageView",
"trackSpaNavigation",
"trackIp",
@@ -281,6 +284,7 @@ class SiteConfigurationLifecycle {
...(input.trackErrors !== undefined && { trackErrors: input.trackErrors }),
...(input.trackOutbound !== undefined && { trackOutbound: input.trackOutbound }),
...(input.trackUrlParams !== undefined && { trackUrlParams: input.trackUrlParams }),
+ ...(input.trackUrlFragments !== undefined && { trackUrlFragments: input.trackUrlFragments }),
...(input.trackInitialPageView !== undefined && { trackInitialPageView: input.trackInitialPageView }),
...(input.trackSpaNavigation !== undefined && { trackSpaNavigation: input.trackSpaNavigation }),
...(input.trackIp !== undefined && { trackIp: input.trackIp }),
diff --git a/server/src/services/sites/unclaimedSites.test.ts b/server/src/services/sites/unclaimedSites.test.ts
index 441a9fdb8..137eeb889 100644
--- a/server/src/services/sites/unclaimedSites.test.ts
+++ b/server/src/services/sites/unclaimedSites.test.ts
@@ -64,6 +64,7 @@ CREATE TABLE sites (
"trackErrors" boolean DEFAULT false,
"trackOutbound" boolean DEFAULT true,
"trackUrlParams" boolean DEFAULT true,
+ "trackUrlFragments" boolean DEFAULT false,
"trackInitialPageView" boolean DEFAULT true,
"trackSpaNavigation" boolean DEFAULT true,
"trackIp" boolean DEFAULT false,