fix(analytics): load working Mixpanel SDK (was 404) + confirm Rybbit removed#4
Conversation
The deployed snippet loaded //cdn.mxpnl.com/libs/mixpanel-js/2.56.0/mixpanel.gsl.js, which 404s — so the SDK never loaded and no events were ever sent (zero data in the dashboard). Switch to the official cdn URL (mixpanel-2-latest.min.js, HTTP 200). Rybbit was already removed on main; confirmed no residue remains in the tree.
Deploying fx-lab with
|
| Latest commit: |
8a40b6c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://61860844.fx-lab.pages.dev |
| Branch Preview URL: | https://fix-mixpanel-sdk-url.fx-lab.pages.dev |
There was a problem hiding this comment.
Pull request overview
This PR fixes production analytics collection by updating the embedded Mixpanel loader snippet to fetch a working Mixpanel SDK URL in the two static HTML entrypoints.
Changes:
- Replaced the Mixpanel SDK
srcfrom the 404ing.../mixpanel-js/2.56.0/mixpanel.gsl.jstohttps://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js. - Applied the same SDK URL change to both
web/index.htmlandsite/index.html.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| web/index.html | Updates Mixpanel SDK URL so the analytics library actually loads. |
| site/index.html | Mirrors the Mixpanel SDK URL fix for the site entrypoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <!-- Mixpanel analytics. The project token is public by design (same as GA/Plausible) — it only identifies which project events belong to; it grants no read access to dashboard data. --> | ||
| <script> | ||
| (function(f,b){if(!b.__SV){var e,g,i,h;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b){var c=b.split(".");2==c.length&&(b=b[c[0]],a[c[0]]=a[c[0]]||{},a=a[c[0]])}b._q.push({a:d});f("track");f("identify");f("reset");f("register");f("alias");f("people.set");f("people.increment");f("track_charge");f("append");b._i[d]={};a&&"function"==typeof a&&(b._i[d]=a)};b.__SV=1.2;e=f.createElement("script");e.type="text/javascript";e.async=!0;e.src="https://cdn.mxpnl.com/libs/mixpanel-js/2.56.0/mixpanel.gsl.js";e.crossOrigin="anonymous";g=f.getElementsByTagName("script")[0];g.parentNode.insertBefore(e,g)}})(document,window.mixpanel||[]); | ||
| (function(f,b){if(!b.__SV){var e,g,i,h;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b){var c=b.split(".");2==c.length&&(b=b[c[0]],a[c[0]]=a[c[0]]||{},a=a[c[0]])}b._q.push({a:d});f("track");f("identify");f("reset");f("register");f("alias");f("people.set");f("people.increment");f("track_charge");f("append");b._i[d]={};a&&"function"==typeof a&&(b._i[d]=a)};b.__SV=1.2;e=f.createElement("script");e.type="text/javascript";e.async=!0;e.src="https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";g=f.getElementsByTagName("script")[0];g.parentNode.insertBefore(e,g)}})(document,window.mixpanel||[]); |
| <!-- Mixpanel analytics. The project token is public by design (same as GA/Plausible) — it only identifies which project events belong to; it grants no read access to dashboard data. --> | ||
| <script> | ||
| (function(f,b){if(!b.__SV){var e,g,i,h;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b){var c=b.split(".");2==c.length&&(b=b[c[0]],a[c[0]]=a[c[0]]||{},a=a[c[0]])}b._q.push({a:d});f("track");f("identify");f("reset");f("register");f("alias");f("people.set");f("people.increment");f("track_charge");f("append");b._i[d]={};a&&"function"==typeof a&&(b._i[d]=a)};b.__SV=1.2;e=f.createElement("script");e.type="text/javascript";e.async=!0;e.src="https://cdn.mxpnl.com/libs/mixpanel-js/2.56.0/mixpanel.gsl.js";e.crossOrigin="anonymous";g=f.getElementsByTagName("script")[0];g.parentNode.insertBefore(e,g)}})(document,window.mixpanel||[]); | ||
| (function(f,b){if(!b.__SV){var e,g,i,h;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b){var c=b.split(".");2==c.length&&(b=b[c[0]],a[c[0]]=a[c[0]]||{},a=a[c[0]])}b._q.push({a:d});f("track");f("identify");f("reset");f("register");f("alias");f("people.set");f("people.increment");f("track_charge");f("append");b._i[d]={};a&&"function"==typeof a&&(b._i[d]=a)};b.__SV=1.2;e=f.createElement("script");e.type="text/javascript";e.async=!0;e.src="https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";g=f.getElementsByTagName("script")[0];g.parentNode.insertBefore(e,g)}})(document,window.mixpanel||[]); |
| <!-- Mixpanel analytics. The project token is public by design (same as GA/Plausible) — it only identifies which project events belong to; it grants no read access to dashboard data. --> | ||
| <script> | ||
| (function(f,b){if(!b.__SV){var e,g,i,h;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b){var c=b.split(".");2==c.length&&(b=b[c[0]],a[c[0]]=a[c[0]]||{},a=a[c[0]])}b._q.push({a:d});f("track");f("identify");f("reset");f("register");f("alias");f("people.set");f("people.increment");f("track_charge");f("append");b._i[d]={};a&&"function"==typeof a&&(b._i[d]=a)};b.__SV=1.2;e=f.createElement("script");e.type="text/javascript";e.async=!0;e.src="https://cdn.mxpnl.com/libs/mixpanel-js/2.56.0/mixpanel.gsl.js";e.crossOrigin="anonymous";g=f.getElementsByTagName("script")[0];g.parentNode.insertBefore(e,g)}})(document,window.mixpanel||[]); | ||
| (function(f,b){if(!b.__SV){var e,g,i,h;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b){var c=b.split(".");2==c.length&&(b=b[c[0]],a[c[0]]=a[c[0]]||{},a=a[c[0]])}b._q.push({a:d});f("track");f("identify");f("reset");f("register");f("alias");f("people.set");f("people.increment");f("track_charge");f("append");b._i[d]={};a&&"function"==typeof a&&(b._i[d]=a)};b.__SV=1.2;e=f.createElement("script");e.type="text/javascript";e.async=!0;e.src="https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";g=f.getElementsByTagName("script")[0];g.parentNode.insertBefore(e,g)}})(document,window.mixpanel||[]); |
| <!-- Mixpanel analytics. The project token is public by design (same as GA/Plausible) — it only identifies which project events belong to; it grants no read access to dashboard data. --> | ||
| <script> | ||
| (function(f,b){if(!b.__SV){var e,g,i,h;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b){var c=b.split(".");2==c.length&&(b=b[c[0]],a[c[0]]=a[c[0]]||{},a=a[c[0]])}b._q.push({a:d});f("track");f("identify");f("reset");f("register");f("alias");f("people.set");f("people.increment");f("track_charge");f("append");b._i[d]={};a&&"function"==typeof a&&(b._i[d]=a)};b.__SV=1.2;e=f.createElement("script");e.type="text/javascript";e.async=!0;e.src="https://cdn.mxpnl.com/libs/mixpanel-js/2.56.0/mixpanel.gsl.js";e.crossOrigin="anonymous";g=f.getElementsByTagName("script")[0];g.parentNode.insertBefore(e,g)}})(document,window.mixpanel||[]); | ||
| (function(f,b){if(!b.__SV){var e,g,i,h;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b){var c=b.split(".");2==c.length&&(b=b[c[0]],a[c[0]]=a[c[0]]||{},a=a[c[0]])}b._q.push({a:d});f("track");f("identify");f("reset");f("register");f("alias");f("people.set");f("people.increment");f("track_charge");f("append");b._i[d]={};a&&"function"==typeof a&&(b._i[d]=a)};b.__SV=1.2;e=f.createElement("script");e.type="text/javascript";e.async=!0;e.src="https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";g=f.getElementsByTagName("script")[0];g.parentNode.insertBefore(e,g)}})(document,window.mixpanel||[]); |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8a40b6cb36
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| <!-- Mixpanel analytics. The project token is public by design (same as GA/Plausible) — it only identifies which project events belong to; it grants no read access to dashboard data. --> | ||
| <script> | ||
| (function(f,b){if(!b.__SV){var e,g,i,h;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b){var c=b.split(".");2==c.length&&(b=b[c[0]],a[c[0]]=a[c[0]]||{},a=a[c[0]])}b._q.push({a:d});f("track");f("identify");f("reset");f("register");f("alias");f("people.set");f("people.increment");f("track_charge");f("append");b._i[d]={};a&&"function"==typeof a&&(b._i[d]=a)};b.__SV=1.2;e=f.createElement("script");e.type="text/javascript";e.async=!0;e.src="https://cdn.mxpnl.com/libs/mixpanel-js/2.56.0/mixpanel.gsl.js";e.crossOrigin="anonymous";g=f.getElementsByTagName("script")[0];g.parentNode.insertBefore(e,g)}})(document,window.mixpanel||[]); | ||
| (function(f,b){if(!b.__SV){var e,g,i,h;window.mixpanel=b;b._i=[];b.init=function(a,e,d){function f(b){var c=b.split(".");2==c.length&&(b=b[c[0]],a[c[0]]=a[c[0]]||{},a=a[c[0]])}b._q.push({a:d});f("track");f("identify");f("reset");f("register");f("alias");f("people.set");f("people.increment");f("track_charge");f("append");b._i[d]={};a&&"function"==typeof a&&(b._i[d]=a)};b.__SV=1.2;e=f.createElement("script");e.type="text/javascript";e.async=!0;e.src="https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";g=f.getElementsByTagName("script")[0];g.parentNode.insertBefore(e,g)}})(document,window.mixpanel||[]); |
There was a problem hiding this comment.
Restore a working Mixpanel bootstrap queue
On every page load, the immediately following mixpanel.init(...) calls this stub before the async SDK can execute, but the stub never initializes b._q; b._q.push(...) therefore throws and the init call is not queued for the newly loaded SDK. As a result, swapping to the live SDK URL still leaves Mixpanel uninitialized and the automatic/page/click events will not be sent; replace this with the official bootstrap snippet or initialize the queue correctly in both mirrored HTML files.
Useful? React with 👍 / 👎.
Why
The Mixpanel snippet in the deployed HTML loaded a non-existent SDK URL, so the dashboard showed zero data.
The SDK never loaded, so every
mixpanel.track(...)in the page only pushed into a stub queue — no network request was ever sent. The project token and init config were correct; only the SDK URL was wrong.What changed
cdn.mxpnl.com/libs/mixpanel-2-latest.min.js(HTTP 200, 103 KB) insite/index.html+web/index.html.track_pageview: true,persistence: \"localStorage\".Rybbit
Already removed on
main(thechore/swap-rybbit-for-mixpanelswap landed). Verified zero residue (rybbit/gsl.js) across the tree — no further action needed.Verification
…/mixpanel-js/2.56.0/mixpanel.gsl.js…/mixpanel-2-latest.min.jscurlconfirms new URL returns valid JS (HTTP 200,text/javascript).grep -rni rybbit\|gsl.js→ no matches.