From c1c70a6ec850af27cf310f41f0907e7d904ae7c6 Mon Sep 17 00:00:00 2001 From: Orest Tarasiuk <830847+OrestTa@users.noreply.github.com> Date: Wed, 23 Sep 2026 19:21:36 +0200 Subject: [PATCH] feat: PostHog on the docs, through a same-site /relay proxy Loads PostHog (project "t1", id 624862) from a head script and sends it through /relay, a Netlify proxy to PostHog, so ad blockers see a request to docs.t1protocol.com. The same proxy serves t1protocol.com, which Firebase Hosting cannot proxy itself. Skipped on localhost. Co-Authored-By: Claude Opus 5.5 --- docusaurus.config.mjs | 9 +++++++++ netlify.toml | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/docusaurus.config.mjs b/docusaurus.config.mjs index aa2244951..7a33e33f8 100644 --- a/docusaurus.config.mjs +++ b/docusaurus.config.mjs @@ -16,6 +16,15 @@ const config = { title: 't1 Docs', tagline: 'Documentation for t1, the permissionless credit protocol for DeFi.', url: 'https://docs.t1protocol.com', + // PostHog project "t1" (shared with t1protocol.com, told apart by $host), sent + // through this site's own /relay proxy (netlify.toml) so ad blockers don't drop it. + headTags: [ + { + tagName: 'script', + attributes: {}, + innerHTML: 'if(!/^(localhost|127\\.0\\.0\\.1)$/.test(location.hostname)){!function(t,e){var o,n,p,r;e.__SV||(window.posthog=e,e._i=[],e.init=function(i,s,a){function g(t,e){var o=e.split(".");2==o.length&&(t=t[o[0]],e=o[1]),t[e]=function(){t.push([e].concat(Array.prototype.slice.call(arguments,0)))}}(p=t.createElement("script")).type="text/javascript",p.crossOrigin="anonymous",p.async=!0,p.src=s.api_host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",(r=t.getElementsByTagName("script")[0]).parentNode.insertBefore(p,r);var u=e;for(void 0!==a?u=e[a]=[]:a="posthog",u.people=u.people||[],u.toString=function(t){var e="posthog";return"posthog"!==a&&(e+="."+a),t||(e+=" (stub)"),e},u.people.toString=function(){return u.toString(1)+".people (stub)"},o="init capture register identify reset get_distinct_id captureException".split(" "),n=0;n