Skip to content

When an integration/plugin fails on ready it prevents analytics.ready()'s execution #1281

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

Open
rmachado-studocu opened this issue Apr 26, 2025 · 1 comment · May be fixed by #1282
Open

When an integration/plugin fails on ready it prevents analytics.ready()'s execution #1281

rmachado-studocu opened this issue Apr 26, 2025 · 1 comment · May be fixed by #1282

Comments

@rmachado-studocu
Copy link

The problem

  • Segment is configured with a couple of integrations/plugins (Facebook Pixel, Mixpanel, etc...)
  • analytics.load() is called
  • User has an ad blocker which blocks Facebook Pixel request (specifically https://connect.facebook.net/en_US/fbevents.js)
Image
  • In analytics.ready(cb), cb is never called.
@silesky
Copy link
Contributor

silesky commented Apr 30, 2025

Thanks for taking out an issue @rmachado-studocu

You're right -- the semantics of analytics.ready are hard to change. A setting like you've suggested in your PR makes sense to me, and it's a public API addition that I will have to mull over with the team.

Quick question: what is your use case?

If you just want to get access to user as soon as analytics loads (which is a probably the most common use case I've seen), one strategy I haven't seen documented is to actually use a utility plugin:

  analytics.register({
      type: 'utility',
      load(_ctx, analytics) {
             console.log(analytics.user()) 
       }
  })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants