segmentio / analytics.js-integrations

Monorepo housing Segment's analytics.js integrations
https://segment.com/docs/destinations/
MIT License
119 stars 141 forks source link

[facebook-pixel] error loading "Facebook Pixel" error="Error: script error "http://connect.facebook.net/en_US/fbevents.js" #54

Open SegmentDestinationsBot opened 6 years ago

SegmentDestinationsBot commented 6 years ago

Migrated from #40 by @Macbit

analytics:integration:facebook-pixel error loading "Facebook Pixel" error="Error: script error "http://connect.facebook.net/en_US/fbevents.js" at HTMLScriptElement.<anonymous> (https://cdn.segment.com/analytics.js/v1/wUgzMSmoJCAqPDNtJ5BfDTzRFWDduzcP/analytics.min.js:10:3537)" +18ms

nhsz commented 5 years ago

@Macbit check if you are blocking analytics with an adblocker/anti-tracking addon or browser config. Hope it helps.

jonathanstokes commented 3 years ago

I can reproduce this issue. If you have a firewall that blocks connect.facebook.net, you will get this error every time.

@nhsz, the bigger problem is not facebook-pixel failing in such cases--that's understandable--but when this error happens no analytics are tracked.

Not sure if this is a problem with faceboox-pixel or more generally with analytics.js-integrations, but it seems like a serious problem.

Anyone have ideas for how to work around it? I don't control the intranets of visitors to my public site, but if one of them is blocking facebook in this way, I'd still like it to track analytics to other destinations that aren't blocked.

jonathanstokes commented 3 years ago

Steps to Reproduce

  1. Have Segment set up with a Facebook Pixel integration.
  2. From the client/browser machine, block access to https://connect.facebook.net. (On MacOS, I used a free trial of Charles to add this URL to the "Block list," with the Blocking Action set to "Return 403 response.")
  3. Connect to the site using the partially blocked browser. (This simulates connecting from any corporate proxy where *.facebook.* is blocked, which has to be common enough.)

Expected Result: The Facebook Pixel part should fail, obviously, but you would think that other Segment Destinations would still receive events.

Actual Result: An error occurs that is fatal to all of the Segment client. No analytics events get tracked because of a failure in this one integration.

The console log shows: image

acorso522 commented 3 years ago

Was this ever resolved? I'm still seeing this issue. Particularly with batch calls.

jonathanstokes commented 2 years ago

Not resolved for me, @acorso522. Still appears with Analytics.js classic and v2. (You must already be using v2 if you're batching.)

acorso522 commented 2 years ago

@jonathanstokes , going back and forth with Segment, we did learn that the issue is related to the analytics.ready() function, where because FB doesn't load, the ready() is blocked. That said, the intent of ready() is to make sure everything is loaded before executing things and when we removed it, we ran into some additional issues. We have also identified that implementing the FB pixel through GTM through Segment or directly seems to circumvent this issues fwiw.