Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat: Don't show live chat bubble on share pages

Richie McIlroy2d7ceff3202f
diff --git a/apps/web/app/providers.tsx b/apps/web/app/providers.tsx
index dd02cbba7..f331fe9db 100644
--- a/apps/web/app/providers.tsx
+++ b/apps/web/app/providers.tsx
@@ -7,6 +7,7 @@ import { PostHogProvider as PHProvider } from "posthog-js/react";
import { clientEnv } from "@cap/env";
import PostHogPageView from "./PosthogPageView";
import Intercom from "@intercom/messenger-js-sdk";
+import { usePathname } from "next/navigation";
export function PostHogProvider({ children }: { children: React.ReactNode }) {
useEffect(() => {
@@ -37,21 +38,28 @@ export function AnalyticsProvider({
name?: string;
email?: string;
}) {
- if (intercomHash === "") {
- Intercom({
- app_id: "efxq71cv",
- utm_source: "web",
- });
- } else {
- Intercom({
- app_id: "efxq71cv",
- user_id: userId ?? "",
- user_hash: intercomHash ?? "",
- name: name,
- email: email,
- utm_source: "web",
- });
- }
+ const pathname = usePathname();
+ const isSharePage = pathname?.startsWith("/s/");
+
+ useEffect(() => {
+ if (!isSharePage) {
+ if (intercomHash === "") {
+ Intercom({
+ app_id: "efxq71cv",
+ utm_source: "web",
+ });
+ } else {
+ Intercom({
+ app_id: "efxq71cv",
+ user_id: userId ?? "",
+ user_hash: intercomHash ?? "",
+ name: name,
+ email: email,
+ utm_source: "web",
+ });
+ }
+ }
+ }, [intercomHash, userId, name, email, isSharePage]);
useEffect(() => {
if (!userId) {