Skip to content

Conversation

@harlan-zw
Copy link
Collaborator

πŸ”— Linked issue

Resolves #461

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Custom events (like proxy.event()) failed silently after page refresh but worked after SPA navigation. The root cause was that use() returned null when window.rybbit was undefined, breaking the proxy's ability to queue calls before the script loaded.

Added clientInit to create a stub that queues calls, and flushQueue() that replays them once the real script loads. This follows the same pattern used by Google Analytics and Plausible.

// Events now work immediately, even before script loads
const { proxy } = useScriptRybbitAnalytics({ siteId: '874' })
proxy.event('my_event', { data: 'value' }) // queued if script not ready, sent when loaded

harlan-zw and others added 4 commits January 16, 2026 01:58
Combined commits:
- fix(plausible): use consistent window reference in clientInit stub
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Jan 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
scripts-docs Error Error Jan 18, 2026 2:55am
scripts-playground Ready Ready Preview, Comment Jan 18, 2026 2:55am

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 18, 2026

Open in StackBlitz

npm i https://pkg.pr.new/nuxt/scripts/@nuxt/scripts@585

commit: 6720a6a

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.

Rybbit analytics custom events not working when refreshing page until you navigate to another page

2 participants