Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Enhance layout component with multiple pixel tracking integrations

Bill Yanged8b69f67e16
diff --git a/client/src/app/layout.tsx b/client/src/app/layout.tsx
index 751c2434a..c894ec3d6 100644
--- a/client/src/app/layout.tsx
+++ b/client/src/app/layout.tsx
@@ -20,21 +20,56 @@ export default function RootLayout({ children }: { children: React.ReactNode })
return (
<html lang="en" className="dark">
- {globalThis?.location?.hostname === "demo.rybbit.io" && (
- <head>
- <Script id="gtm-script" strategy="afterInteractive">
- {`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
+ {globalThis?.location?.hostname === "demo.rybbit.io" ||
+ (globalThis?.location?.hostname === "app.rybbit.io" && (
+ <head>
+ <Script id="gtm-script" strategy="afterInteractive">
+ {`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-KWZ8K6K9');`}
- </Script>
- </head>
- )}
+ </Script>
+ <Script
+ id="reddit-pixel"
+ strategy="afterInteractive"
+ dangerouslySetInnerHTML={{
+ __html: `!function(w,d){if(!w.rdt){var p=w.rdt=function(){p.sendEvent?p.sendEvent.apply(p,arguments):p.callQueue.push(arguments)};p.callQueue=[];var t=d.createElement("script");t.src="https://www.redditstatic.com/ads/pixel.js",t.async=!0;var s=d.getElementsByTagName("script")[0];s.parentNode.insertBefore(t,s)}}(window,document);rdt('init','a2_hpzt3lz1c1f0');rdt('track', 'PageVisit');`,
+ }}
+ />
+ <Script
+ id="twitter-pixel"
+ strategy="afterInteractive"
+ dangerouslySetInnerHTML={{
+ __html: `!function(e,t,n,s,u,a){e.twq||(s=e.twq=function(){s.exe?s.exe.apply(s,arguments):s.queue.push(arguments);
+},s.version='1.1',s.queue=[],u=t.createElement(n),u.async=!0,u.src='https://static.ads-twitter.com/uwt.js',
+a=t.getElementsByTagName(n)[0],a.parentNode.insertBefore(u,a))}(window,document,'script');
+twq('config','qj0po');`,
+ }}
+ />
+ <Script
+ id="facebook-pixel"
+ strategy="afterInteractive"
+ dangerouslySetInnerHTML={{
+ __html: `!function(f,b,e,v,n,t,s)
+{if(f.fbq)return;n=f.fbq=function(){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)}(window,document,'script',
+'https://connect.facebook.net/en_US/fbevents.js');
+fbq('init', '816836311029789');
+fbq('track', 'PageView');`,
+ }}
+ />
+ </head>
+ ))}
<ReactScan />
<TooltipProvider>
<body className={cn("bg-background text-foreground h-full", inter.className)}>
- {globalThis?.location?.hostname === "demo.rybbit.io" && (
+ {(globalThis?.location?.hostname === "demo.rybbit.io" ||
+ globalThis?.location?.hostname === "app.rybbit.io") && (
<noscript>
<iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-KWZ8K6K9"