From 97ee90919f53603249fbf2226967b36f6cbcdb55 Mon Sep 17 00:00:00 2001 From: Rami Bitar Date: Wed, 29 Jul 2026 12:52:28 -0400 Subject: [PATCH] Comment out all analytics (trackers, Shopify scripts, consent banner) Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01F22Ms5Cxam5UHyxaCrtZzu --- app/app-shell.tsx | 27 ++++++++-------- app/cart/page.tsx | 5 ++- app/providers.tsx | 24 ++++++++------ components/CollectionBrowser.tsx | 55 +++++++++++++++++--------------- components/ProductDetails.tsx | 5 ++- 5 files changed, 65 insertions(+), 51 deletions(-) diff --git a/app/app-shell.tsx b/app/app-shell.tsx index 925d0cb..86df0cf 100644 --- a/app/app-shell.tsx +++ b/app/app-shell.tsx @@ -1,15 +1,18 @@ import "server-only"; -import { analyticsConsent as analyticsConsentConfig } from "@shared/config"; +// ANALYTICS DISABLED (temporarily commented out): +// import { analyticsConsent as analyticsConsentConfig } from "@shared/config"; import { connection } from "next/server"; import { Suspense } from "react"; import { CartDrawer } from "@/components/CartDrawer"; -import { ConsentBanner } from "@/components/ConsentBanner"; +// ANALYTICS DISABLED (temporarily commented out): +// import { ConsentBanner } from "@/components/ConsentBanner"; import { Footer } from "@/components/Footer"; import { Header } from "@/components/Header"; import { HeaderAccountLink, HeaderAccountLinkFallback } from "@/components/HeaderAccountLink"; -import { ShopifyScriptsClient } from "@/components/ShopifyScriptsClient"; -import { getAnalyticsShop, getScriptsShop } from "@/lib/analytics-shop"; +// ANALYTICS DISABLED (temporarily commented out): +// import { ShopifyScriptsClient } from "@/components/ShopifyScriptsClient"; +// import { getAnalyticsShop, getScriptsShop } from "@/lib/analytics-shop"; import { cartHandlers } from "@/lib/cart-handlers"; import { getStorefrontClient } from "@/lib/storefront"; @@ -47,17 +50,12 @@ export async function AppShell({ children }: { children: React.ReactNode }) { cartData = undefined; } - // Analytics shop GID: best-effort, non-blocking (F1). Merged with - // `@shared/config` metadata (acceptedLanguage/currency/hydrogenSubchannelId). - const analyticsShop = await getAnalyticsShop(); - const scriptsShop = getScriptsShop(); + // ANALYTICS DISABLED (temporarily commented out): + // const analyticsShop = await getAnalyticsShop(); + // const scriptsShop = getScriptsShop(); return ( - + + {/* ANALYTICS DISABLED (temporarily commented out): - + */} ); } diff --git a/app/cart/page.tsx b/app/cart/page.tsx index 530657a..6e842d3 100644 --- a/app/cart/page.tsx +++ b/app/cart/page.tsx @@ -2,7 +2,8 @@ import type { Metadata } from "next"; import { CartCheckoutButton } from "@/components/CartCheckoutButton"; import { CartContent } from "@/components/CartContent"; -import { CartViewedTracker } from "@/components/CartViewedTracker"; +// ANALYTICS DISABLED (temporarily commented out): +// import { CartViewedTracker } from "@/components/CartViewedTracker"; import { content } from "@/lib/content"; import { canonicalUrl } from "@/lib/site"; @@ -38,7 +39,9 @@ export default function CartPage() {
+ {/* ANALYTICS DISABLED (temporarily commented out): + */}
); diff --git a/app/providers.tsx b/app/providers.tsx index 6f51299..87b0da8 100644 --- a/app/providers.tsx +++ b/app/providers.tsx @@ -1,11 +1,13 @@ "use client"; -import type { ConsentConfig, ShopAnalytics } from "@shopify/hydrogen"; -import { Suspense } from "react"; +// ANALYTICS DISABLED (temporarily commented out): +// import type { ConsentConfig, ShopAnalytics } from "@shopify/hydrogen"; +// import { Suspense } from "react"; import type { ReactNode } from "react"; -import { AnalyticsTracker } from "@/components/AnalyticsTracker"; -import { CartAnalyticsTracker } from "@/components/CartAnalyticsTracker"; +// ANALYTICS DISABLED (temporarily commented out): +// import { AnalyticsTracker } from "@/components/AnalyticsTracker"; +// import { CartAnalyticsTracker } from "@/components/CartAnalyticsTracker"; import { CartProvider } from "@/lib/cart"; import type { cartHandlers } from "@/lib/cart-handlers"; @@ -30,23 +32,25 @@ export type CartData = Awaited>["data"]; export function Providers({ cartData, - analyticsShop, - analyticsConsent, + // ANALYTICS DISABLED (temporarily commented out): + // analyticsShop, + // analyticsConsent, children, }: { cartData?: CartData; - analyticsShop: ShopAnalytics; - analyticsConsent: ConsentConfig; + // ANALYTICS DISABLED (temporarily commented out): + // analyticsShop: ShopAnalytics; + // analyticsConsent: ConsentConfig; children: ReactNode; }) { return ( - {/* Suspense scopes the `useSearchParams()` CSR bailout to the tracker, - not the whole layout (hydrogen-analytics / references/react.md). */} + {/* ANALYTICS DISABLED (temporarily commented out): + */} {children} ); diff --git a/components/CollectionBrowser.tsx b/components/CollectionBrowser.tsx index a287366..ab6e538 100644 --- a/components/CollectionBrowser.tsx +++ b/components/CollectionBrowser.tsx @@ -10,11 +10,13 @@ import { import { CollectionProvider, useCollection, useCollectionForm } from "@shopify/hydrogen/react"; import Link from "next/link"; import { usePathname, useRouter, useSearchParams } from "next/navigation"; -import { useEffect, useMemo } from "react"; +// ANALYTICS DISABLED: `useEffect` was only used by the viewed-trackers below. +import { useMemo } from "react"; import { Breadcrumbs } from "@/components/Breadcrumbs"; import { ProductCard, type ProductCardData } from "@/components/ProductCard"; -import { AnalyticsEvent, getAnalytics } from "@/lib/analytics"; +// ANALYTICS DISABLED (temporarily commented out): +// import { AnalyticsEvent, getAnalytics } from "@/lib/analytics"; import { content } from "@/lib/content"; import { FilterGroup } from "@/lib/filters"; @@ -94,39 +96,42 @@ export function CollectionBrowser(props: CollectionBrowserProps) { router.refresh(); }} > + {/* ANALYTICS DISABLED (temporarily commented out): {props.mode === "collection" ? ( ) : ( )} + */} {props.mode === "collection" ? : } ); } -function CollectionViewedTracker({ id, handle }: { id: string; handle: string }) { - useEffect(() => { - const analytics = getAnalytics(); - if (!analytics) return; - analytics.publish(AnalyticsEvent.COLLECTION_VIEWED, { - collection: { id, handle }, - }); - }, [id, handle]); - return null; -} - -function SearchViewedTracker({ term, totalCount }: { term: string; totalCount: number }) { - useEffect(() => { - if (!term) return; - const analytics = getAnalytics(); - if (!analytics) return; - analytics.publish(AnalyticsEvent.SEARCH_VIEWED, { - searchTerm: term, - searchResults: { totalCount }, - }); - }, [term, totalCount]); - return null; -} +// ANALYTICS DISABLED (temporarily commented out): +// function CollectionViewedTracker({ id, handle }: { id: string; handle: string }) { +// useEffect(() => { +// const analytics = getAnalytics(); +// if (!analytics) return; +// analytics.publish(AnalyticsEvent.COLLECTION_VIEWED, { +// collection: { id, handle }, +// }); +// }, [id, handle]); +// return null; +// } +// +// function SearchViewedTracker({ term, totalCount }: { term: string; totalCount: number }) { +// useEffect(() => { +// if (!term) return; +// const analytics = getAnalytics(); +// if (!analytics) return; +// analytics.publish(AnalyticsEvent.SEARCH_VIEWED, { +// searchTerm: term, +// searchResults: { totalCount }, +// }); +// }, [term, totalCount]); +// return null; +// } type CollectionPageProps = Extract; diff --git a/components/ProductDetails.tsx b/components/ProductDetails.tsx index f247297..db8fa84 100644 --- a/components/ProductDetails.tsx +++ b/components/ProductDetails.tsx @@ -5,7 +5,8 @@ import { ShopPayButton } from "@shopify/hydrogen/react"; import Link from "next/link"; import { useRouter, useSearchParams } from "next/navigation"; -import { ProductViewedTracker } from "@/components/ProductViewedTracker"; +// ANALYTICS DISABLED (temporarily commented out): +// import { ProductViewedTracker } from "@/components/ProductViewedTracker"; import { QuantityStepper } from "@/components/QuantityStepper"; import { openCartDrawer } from "@/lib/cart-drawer"; import { content } from "@/lib/content"; @@ -40,7 +41,9 @@ export function ProductDetails({ product }: { product: ProductData }) { router.replace(next, { scroll: false }); }} > + {/* ANALYTICS DISABLED (temporarily commented out): + */} );