Skip to content

feat: add rybbit analytics to registry #453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2025
Merged

Conversation

dankerow
Copy link
Contributor

πŸ”— Linked issue

❓ 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

Add Rybbit Analytics to registry

Copy link

vercel bot commented May 14, 2025

@dankerow is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Collaborator

@harlan-zw harlan-zw left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for your work on this πŸ™Œ

@harlan-zw harlan-zw merged commit 4d6cbe4 into nuxt:main May 18, 2025
1 of 3 checks passed
@bananacity
Copy link

bananacity commented Jun 1, 2025

Hi, I'm trying to use rybbit using this and it works perfectly for standard page views etc but I'm struggling with custom events seemingly randomly not being sent? It seems that if I do a hard refresh on my page and try to trigger an event then it isn't sent. but if i then navigate to a different page then back then the events are correctly sent

This is my nuxt config setup for my self hosted instance.
// Nuxt scripts module scripts: { registry: { // Website analytics Rybbit.io rybbitAnalytics: { scriptInput: { src: 'https://tracking.mywebsite.com/api/script.js', }, siteId: '1', }, }, },
and then on various pages i use
const { proxy } = useScriptRybbitAnalytics() proxy.rybbit.event('onboarding_completed')

proxy.rybbit.identify(currentUser.id) proxy.rybbit.event('signed_out') proxy.rybbit.clearUserId() Could it be something to do with SSR potentially? Still new to nuxt so not 100% sure but wanted to check

@harlan-zw
Copy link
Collaborator

harlan-zw commented Jun 2, 2025

@bananacity it may be double registering the script as you've modified the script src for the global one. Nuxt Scripts lets you load in multiple analytics scripts.

I'd suggest using just the composable if you want to send custom events, so you would do:

const { proxy } = useScriptRybbitAnalytics({
  siteId: 1,
  scriptInput: { src: 'https://tracking.mywebsite.com/api/script.js' },
})

proxy.event('foo')

and remove the config from nuxt.config.

(btw i pushed up some fixes for the types)

If you still have issues please make a dedicated issue to track.

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.

3 participants