From 89993d70cc78678f824cda9f188564c6544d1c21 Mon Sep 17 00:00:00 2001 From: dhananjay6561 Date: Wed, 14 Oct 2026 10:58:24 +0530 Subject: [PATCH] fix(analytics): load meta pixel only on keploy.io Signed-off-by: dhananjay6561 --- docusaurus.config.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 59ad65d9b..b5e00c208 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -107,10 +107,14 @@ module.exports = { // Meta Pixel Code — fires eagerly (init + PageView) on load so conversion // tracking is accurate from the first paint. Intentionally NOT deferred. // SPA route changes re-fire PageView from src/metaPixelRouteTracker.js. + // Only loads on keploy.io / www.keploy.io, so localhost, staging and + // Vercel previews never send events into the production pixel. Without + // fbq, the route tracker no-ops too. { tagName: "script", attributes: {}, - innerHTML: `!function(f,b,e,v,n,t,s) + innerHTML: `if (/^(www\\.)?keploy\\.io$/.test(window.location.hostname)) { +!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'; @@ -119,7 +123,8 @@ 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', '2006330080011702'); -fbq('track', 'PageView');`, +fbq('track', 'PageView'); +}`, }, { tagName: "noscript",