Skip to content

fix(analytics): load working Mixpanel SDK (was 404) + confirm Rybbit removed#4

Merged
rosuH merged 1 commit into
mainfrom
fix/mixpanel-sdk-url
Jul 2, 2026
Merged

fix(analytics): load working Mixpanel SDK (was 404) + confirm Rybbit removed#4
rosuH merged 1 commit into
mainfrom
fix/mixpanel-sdk-url

Conversation

@rosuH

@rosuH rosuH commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Why

The Mixpanel snippet in the deployed HTML loaded a non-existent SDK URL, so the dashboard showed zero data.

//cdn.mxpnl.com/libs/mixpanel-js/2.56.0/mixpanel.gsl.js  →  HTTP 404

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

  • Swap the SDK URL → official cdn.mxpnl.com/libs/mixpanel-2-latest.min.js (HTTP 200, 103 KB) in site/index.html + web/index.html.
  • All other config kept as-is: same project token, track_pageview: true, persistence: \"localStorage\".

Rybbit

Already removed on main (the chore/swap-rybbit-for-mixpanel swap landed). Verified zero residue (rybbit / gsl.js) across the tree — no further action needed.

Verification

URL Before After
…/mixpanel-js/2.56.0/mixpanel.gsl.js 404 ❌ removed
…/mixpanel-2-latest.min.js 200 ✅
  • curl confirms new URL returns valid JS (HTTP 200, text/javascript).
  • grep -rni rybbit\|gsl.js → no matches.

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.
Copilot AI review requested due to automatic review settings July 2, 2026 00:37
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying fx-lab with  Cloudflare Pages  Cloudflare Pages

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

View logs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 src from the 404ing .../mixpanel-js/2.56.0/mixpanel.gsl.js to https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js.
  • Applied the same SDK URL change to both web/index.html and site/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.

Comment thread web/index.html
<!-- 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||[]);
Comment thread web/index.html
<!-- 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||[]);
Comment thread site/index.html
<!-- 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||[]);
Comment thread site/index.html
<!-- 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||[]);

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread site/index.html
<!-- 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||[]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@rosuH rosuH merged commit 11f51bf into main Jul 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants