Template
Comment out all analytics (trackers, Shopify scripts, consent banner)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F22Ms5Cxam5UHyxaCrtZzu
This commit is contained in:
co-authored by
Claude Fable 5
parent
1e58ba4ca4
commit
97ee90919f
+13
-14
@@ -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 (
|
||||
<Providers
|
||||
cartData={cartData}
|
||||
analyticsShop={analyticsShop}
|
||||
analyticsConsent={analyticsConsentConfig}
|
||||
>
|
||||
<Providers cartData={cartData}>
|
||||
<a
|
||||
href="#main-content"
|
||||
className="focus-visible:bg-interactive focus-visible:text-interactive-text sr-only focus-visible:not-sr-only focus-visible:fixed focus-visible:start-4 focus-visible:top-4 focus-visible:z-50 focus-visible:rounded focus-visible:px-4 focus-visible:py-2"
|
||||
@@ -80,9 +78,10 @@ export async function AppShell({ children }: { children: React.ReactNode }) {
|
||||
<Footer />
|
||||
|
||||
<CartDrawer />
|
||||
{/* ANALYTICS DISABLED (temporarily commented out):
|
||||
<ConsentBanner />
|
||||
|
||||
<ShopifyScriptsClient shop={scriptsShop} />
|
||||
*/}
|
||||
</Providers>
|
||||
);
|
||||
}
|
||||
|
||||
+4
-1
@@ -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() {
|
||||
<div className="mx-auto max-w-2xl">
|
||||
<CartContent />
|
||||
<CartCheckoutButton />
|
||||
{/* ANALYTICS DISABLED (temporarily commented out):
|
||||
<CartViewedTracker />
|
||||
*/}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
+14
-10
@@ -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<ReturnType<typeof cartHandlers.get>>["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 (
|
||||
<CartProvider initialData={cartData}>
|
||||
{/* Suspense scopes the `useSearchParams()` CSR bailout to the tracker,
|
||||
not the whole layout (hydrogen-analytics / references/react.md). */}
|
||||
{/* ANALYTICS DISABLED (temporarily commented out):
|
||||
<Suspense fallback={null}>
|
||||
<AnalyticsTracker shop={analyticsShop} consent={analyticsConsent} />
|
||||
</Suspense>
|
||||
<CartAnalyticsTracker />
|
||||
*/}
|
||||
{children}
|
||||
</CartProvider>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user