πΈ Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Enhance Sidebar and Session Replay Page with Environment Checks
Bill Yange3bc90e63188
diff --git a/client/src/app/[site]/components/Sidebar/Sidebar.tsx b/client/src/app/[site]/components/Sidebar/Sidebar.tsxindex a428128ce..f96a55050 100644--- a/client/src/app/[site]/components/Sidebar/Sidebar.tsx+++ b/client/src/app/[site]/components/Sidebar/Sidebar.tsx@@ -32,6 +32,7 @@ import { getSiteRouteContext } from "../../../../lib/siteRoute";import { useEmbedPageOptions } from "../../utils";import { SiteSelector } from "./SiteSelector";import { useStripeSubscription } from "../../../../lib/subscription/useStripeSubscription";+import { useAppEnv } from "../../../../hooks/useIsProduction";function SidebarContent() {const t = useExtracted();@@ -39,6 +40,7 @@ function SidebarContent() {const pathname = usePathname();const searchParams = useSearchParams();const { embed, hideSidebar } = useEmbedPageOptions();+ const appEnv = useAppEnv();const { data: site } = useGetSite(Number(pathname.split("/")[1]));const isMobileSite = site?.type === "mobile";@@ -144,14 +146,17 @@ function SidebarContent() {)}<SidebarComponents.SectionHeader>{t("Product Analytics")}</SidebarComponents.SectionHeader><div className="hidden md:block">- {!isMobileSite && !subscription?.planName?.startsWith("appsumo") && !isSubscriptionLoading && (- <SidebarComponents.Item- label={t("Replay")}- active={isActiveTab("replay")}- href={getTabPath("replay")}- icon={<Video className="w-4 h-4" />}- />- )}+ {!isMobileSite &&+ !subscription?.planName?.startsWith("appsumo") &&+ !isSubscriptionLoading &&+ appEnv !== "demo" && (+ <SidebarComponents.Item+ label={t("Replay")}+ active={isActiveTab("replay")}+ href={getTabPath("replay")}+ icon={<Video className="w-4 h-4" />}+ />+ )}</div>{/* {!privateKey && (<SidebarComponents.Itemdiff --git a/client/src/app/[site]/replay/page.tsx b/client/src/app/[site]/replay/page.tsxindex 317177a03..c83aef1ff 100644--- a/client/src/app/[site]/replay/page.tsx+++ b/client/src/app/[site]/replay/page.tsx@@ -17,10 +17,13 @@ import { SESSION_REPLAY_PAGE_FILTERS } from "../../../lib/filterGroups";import { SubHeader } from "../components/SubHeader/SubHeader";import { EnableSessionReplay } from "./components/EnableSessionReplay";import { ReplayList } from "./components/ReplayList";+import { useAppEnv } from "../../../hooks/useIsProduction";export default function SessionReplayPage() {const t = useExtracted();useSetPageTitle("Session Replay");+ const appEnv = useAppEnv();+ if (appEnv === "demo") return null;const { minDuration, sessionId } = useReplayStore(useShallow(s => ({ minDuration: s.minDuration, sessionId: s.sessionId }))diff --git a/docs/content/docs/(docs)/funnels.mdx b/docs/content/docs/(docs)/funnels.mdxindex 38fb1a96a..4aa0cbf4f 100644--- a/docs/content/docs/(docs)/funnels.mdx+++ b/docs/content/docs/(docs)/funnels.mdx@@ -7,7 +7,7 @@ import { Step, Steps } from 'fumadocs-ui/components/steps';-Funnels let you define a sequence of steps β page visits or custom events β and measure how many users progress through each stage. You can see where users convert, where they drop off, and drill into the sessions at each step to understand why.+Funnels let you define a sequence of steps β page visits, custom events, or autocaptured interactions β and measure how many users progress through each stage. You can see where users convert, where they drop off, and drill into the sessions at each step to understand why.## Creating a Funnel@@ -18,7 +18,7 @@ Funnels let you define a sequence of steps β page visits or custom events βEach funnel has:- **Name** β A label for the funnel (e.g., "Signup Flow", "Checkout Process")-- **Steps** β Two or more sequential steps, each tracking a page visit or custom event+- **Steps** β Two or more sequential steps, each tracking a page visit, custom event, outbound link, button click, form submission, or copy event</Step><Step>@@ -26,10 +26,10 @@ Each funnel has:A funnel always must have at least two steps.-There are two types of steps: **Path Steps** and **Event Steps**.+There are six types of funnel steps. Path and custom event steps require a value. For the four autocaptured interaction types, the pattern is optionalβleave it empty to match every interaction of that type.-<Tabs items={['Path Steps', 'Event Steps']}>-<Tab value="Path Steps">+<Tabs items={['Path', 'Custom Event', 'Outbound Link', 'Button Click', 'Form Submit', 'Copy']}>+<Tab value="Path">Path steps match pageview events by URL path.- Enter a URL path starting with `/`@@ -38,12 +38,47 @@ Path steps match pageview events by URL path.- `**` matches multiple segments β `/docs/**` matches `/docs/api/v2/intro`</Tab>-<Tab value="Event Steps">-Event steps match custom events by name (e.g., `add_to_cart`, `purchase_completed`).+<Tab value="Custom Event">+Custom event steps match events by name (e.g., `add_to_cart`, `purchase_completed`).Events must be tracked using the Rybbit tracking script. See [Track Events](/docs/track-events) for setup instructions.</Tab>+<Tab value="Outbound Link">+Outbound link steps match clicks on links that lead away from your site.++- Enter a destination URL pattern such as `https://example.com/pricing` or `https://*.example.com/**`+- Leave the pattern empty to match any outbound click++Outbound link tracking is enabled by default.+</Tab>+<Tab value="Button Click">+Button click steps match clicks on buttons, button/submit inputs, and elements with `role="button"`.++- Enter a visible button-text pattern such as `Sign Up` or `Start * Trial`+- Leave the pattern empty to match any button click++Buttons that already use `data-rybbit-event` are recorded as custom events instead.+</Tab>+<Tab value="Form Submit">+Form submit steps match submissions of HTML forms.++- Enter a form name or ID pattern such as `signup-form`+- The pattern can also match the form's action URL+- Leave the pattern empty to match any form submission+</Tab>+<Tab value="Copy">+Copy steps match text that visitors copy from your site.++- Enter a copied-text pattern such as `PROMO*`+- Leave the pattern empty to match any copied text+</Tab></Tabs>++Autocaptured interaction patterns support wildcards: `*` matches one or more characters and `**` also matches an empty value. The form suggests values already observed on your site.++<Callout type="info" title="Enable autocapture first">+Button click, form interaction, and copy tracking are disabled by default. Enable the event types you want to use in the **Tracking** tab of your site settings. Only interactions collected after tracking is enabled can appear in a funnel. See [Autocapture](/docs/autocapture) for the properties collected with each type.+</Callout></Step><Step>### Configure Step Options (optional)@@ -54,7 +89,7 @@ Each step has additional configuration options:- **Label** (optional) β A friendly display name for the step- **Hostname** (optional) β Restrict matching to a specific domain, useful for multi-domain sites-- **Property Filters** (optional) β Filter by URL parameters (for page steps) or event properties (for event steps). Multiple filters can be added per step, and all must match.+- **Property Filters** (optional) β Filter by URL parameters (for path steps) or event properties (for all other step types). Multiple filters can be added per step, and all must match.</Step></Steps>@@ -87,5 +122,6 @@ Each session shows entry/exit pages, duration, location, device info, referrer,---**Related Documentation:**+- [Autocapture](/docs/autocapture) β Configure automatically captured interactions- [Goals](/docs/goals) β Track single-action conversions- [Track Events](/docs/track-events) β Set up custom event trackingdiff --git a/docs/content/docs/(docs)/goals.mdx b/docs/content/docs/(docs)/goals.mdxindex 4687ef25e..6e0b9ca97 100644--- a/docs/content/docs/(docs)/goals.mdx+++ b/docs/content/docs/(docs)/goals.mdx@@ -1,13 +1,13 @@---title: Goals-description: Track conversions by monitoring page visits and custom events+description: Track conversions from page visits, custom events, and autocaptured interactions---import { Tab, Tabs } from 'fumadocs-ui/components/tabs';import { Step, Steps } from 'fumadocs-ui/components/steps';-Goals let you define specific actions β visiting a page or triggering an event β and measure how often your visitors complete them. Each goal tracks a conversion rate against total sessions, giving you a clear picture of how effectively your site drives key outcomes.+Goals let you define specific actions β from visiting a page to clicking a button β and measure how often your visitors complete them. Each goal tracks a conversion rate against total sessions, giving you a clear picture of how effectively your site drives key outcomes.## Creating a Goal@@ -18,21 +18,17 @@ Goals let you define specific actions β visiting a page or triggering an eventEvery goal has:- **Name** (optional) β A friendly label like "Completed Checkout" or "Signed Up"-- **Type** β Either **Page Goal** or **Event Goal**-- **Value** β The path pattern (for page goals) or event name (for event goals)--<Callout type="warn" title="Goal type is permanent">-You cannot change a goal's type after creation. If you need a different type, create a new goal.-</Callout>+- **Type** β Page, custom event, outbound link, button click, form submission, or copied text+- **Value** β A required path or custom event name, or an optional pattern that narrows an autocaptured interaction</Step><Step>### Choose a Goal Type-There are two types of goals: **Page Goals** and **Event Goals**.+There are six goal types. Page and custom event goals require a value. For the four autocaptured interaction types, the pattern is optionalβleave it empty to count every interaction of that type.-<Tabs items={['Page Goals', 'Event Goals']}>-<Tab value="Page Goals">+<Tabs items={['Page', 'Custom Event', 'Outbound Link', 'Button Click', 'Form Submit', 'Copy']}>+<Tab value="Page">Page goals track when a user visits a URL matching a given path pattern.- The value must be a path starting with `/` (not a full URL)@@ -43,12 +39,47 @@ Page goals track when a user visits a URL matching a given path pattern.The form provides autocomplete suggestions based on actual paths seen on your site.</Tab>-<Tab value="Event Goals">-Event goals track when a custom event with a specific name is fired. The value is the event name (e.g., `signup_clicked`, `purchase_completed`).+<Tab value="Custom Event">+Custom event goals track when an event with a specific name is fired. The value is the event name (e.g., `signup_clicked`, `purchase_completed`).Events must be tracked using the Rybbit tracking script. See [Track Events](/docs/track-events) for setup instructions.</Tab>+<Tab value="Outbound Link">+Outbound link goals track clicks on links that lead away from your site.++- Enter a destination URL pattern such as `https://example.com/pricing` or `https://*.example.com/**`+- Leave the pattern empty to count clicks to any external URL++Outbound link tracking is enabled by default.+</Tab>+<Tab value="Button Click">+Button click goals track clicks on buttons, button/submit inputs, and elements with `role="button"`.++- Enter a visible button-text pattern such as `Sign Up` or `Start * Trial`+- Leave the pattern empty to count any button click++Buttons that already use `data-rybbit-event` are recorded as custom events instead.+</Tab>+<Tab value="Form Submit">+Form submit goals track submissions of HTML forms.++- Enter a form name or ID pattern such as `signup-form`+- The pattern can also match the form's action URL+- Leave the pattern empty to count any form submission+</Tab>+<Tab value="Copy">+Copy goals track text that visitors copy from your site.++- Enter a copied-text pattern such as `PROMO*`+- Leave the pattern empty to count any copied text+</Tab></Tabs>++Autocaptured interaction patterns support wildcards: `*` matches one or more characters and `**` also matches an empty value. The form suggests values already observed on your site.++<Callout type="info" title="Enable autocapture first">+Button click, form interaction, and copy tracking are disabled by default. Enable the event types you want to use in the **Tracking** tab of your site settings. Only interactions collected after tracking is enabled can count toward a goal. See [Autocapture](/docs/autocapture) for the properties collected with each type.+</Callout></Step><Step>### Add Property Filters (optional)@@ -58,7 +89,8 @@ Events must be tracked using the Rybbit tracking script. See [Track Events](/docYou can narrow a goal to only count conversions when specific properties match:- **Page goals** β Filter by URL parameters (e.g., only count visits where `utm_source=adwords`)-- **Event goals** β Filter by event properties (e.g., only count events where `plan=premium`)+- **Custom event goals** β Filter by event properties (e.g., only count events where `plan=premium`)+- **Autocaptured interaction goals** β Filter by captured properties such as `url`, `text`, `formName`, `formId`, or `formAction`Toggle **Match specific URL parameters** or **Match specific event properties** to add filters. You can add multiple filters per goal β all filters must match for a session to count as a conversion.@@ -91,5 +123,6 @@ Sessions are sorted by most recent first and paginated.---**Related Documentation:**+- [Autocapture](/docs/autocapture) β Configure automatically captured interactions- [Track Events](/docs/track-events) β Set up custom event tracking- [Funnels](/docs/funnels) β Analyze multi-step conversion paths