浏览代码

chore(layout): remove Facebook Pixel integration and related files to streamline the codebase and reduce dependencies (#33)

chore(tsconfig): update include paths to reflect the removal of Facebook Pixel scripts
Mat B. 1 月之前
父节点
当前提交
14a9047b1c
共有 4 个文件被更改,包括 1 次插入60 次删除
  1. 0 2
      app/[locale]/layout.tsx
  2. 0 23
      public/scripts/pixel.js
  3. 0 34
      src/components/FacebookPixel.tsx
  4. 1 1
      tsconfig.json

+ 0 - 2
app/[locale]/layout.tsx

@@ -13,7 +13,6 @@ import { Header } from "@/features/layout/Header";
 import { Footer } from "@/features/layout/Footer";
 import { TailwindIndicator } from "@/components/utils/TailwindIndicator";
 import { NextTopLoader } from "@/components/ui/next-top-loader";
-import FacebookPixel from "@/components/FacebookPixel";
 
 import { Providers } from "./providers";
 
@@ -163,7 +162,6 @@ export default async function RootLayout({ params, children }: RootLayoutProps)
             </div>
 
             <TailwindIndicator />
-            <FacebookPixel />
           </Providers>
         </body>
       </html>

+ 0 - 23
public/scripts/pixel.js

@@ -1,23 +0,0 @@
-const PIXEL_ID = document.currentScript.getAttribute("data-pixel-id");
-
-function initializeFacebookPixel(f, b, e, v, n, t, s) {
-  if (f.fbq) return;
-  n = f.fbq = function () {
-    // eslint-disable-next-line
-    n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments);
-  };
-  if (!f._fbq) f._fbq = n;
-  n.push = n;
-  n.loaded = !0;
-  n.version = "2.0";
-  n.queue = [];
-  t = b.createElement(e);
-  t.async = !0;
-  t.src = v;
-  s = b.getElementsByTagName(e)[0];
-  s.parentNode.insertBefore(t, s);
-}
-
-initializeFacebookPixel(window, document, "script", "https://connect.facebook.net/en_US/fbevents.js");
-
-window.fbq("init", PIXEL_ID);

+ 0 - 34
src/components/FacebookPixel.tsx

@@ -1,34 +0,0 @@
-"use client";
-
-import { useEffect, useState } from "react";
-import Script from "next/script";
-import { usePathname } from "next/navigation";
-
-import * as pixel from "@/workoutcool/shared/lib/facebook/fb-pixel";
-
-const FacebookPixel = () => {
-  const [loaded, setLoaded] = useState(false);
-  const pathname = usePathname();
-
-  useEffect(() => {
-    if (!loaded) return;
-
-    // setTimeout(() => {
-    pixel.pageview();
-    // }, 200);
-  }, [pathname, loaded]);
-
-  return (
-    <div>
-      <Script
-        data-pixel-id={pixel.FB_PIXEL_ID}
-        id="fb-pixel"
-        onLoad={() => setLoaded(true)}
-        src="/scripts/pixel.js"
-        strategy="afterInteractive"
-      />
-    </div>
-  );
-};
-
-export default FacebookPixel;

+ 1 - 1
tsconfig.json

@@ -27,5 +27,5 @@
     ]
   },
   "exclude": ["node_modules", "src/utils/inapp.js", "src/utils/externalLinkOpener.js", "src/utils/browserEscape.js"],
-  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "tailwind.config.ts", "public/scripts/pixel.js"]
+  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "tailwind.config.ts"]
 }