Skip to content
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

Safari's Enhanced Tracking Protection Leads to Unhandled Promise Rejection #1074

Closed
mwisner opened this issue Apr 24, 2024 · 11 comments · Fixed by #1076
Closed

Safari's Enhanced Tracking Protection Leads to Unhandled Promise Rejection #1074

mwisner opened this issue Apr 24, 2024 · 11 comments · Fixed by #1076

Comments

@mwisner
Copy link

mwisner commented Apr 24, 2024

Hi,

I've encountered an issue where using GAv4 in device mode, alongside Safari's "Advanced Tracking and Fingerprint Protection", triggers an unhandled promise error.

Here's a screenshot illustrating the issue:

Screenshot 2024-04-23 at 3 40 14 AM

Upon further investigation I was able to narrow it down to a specific version of the analytics-next package. It seems like this issue is only reproducible in 1.66.0+. When I downgrade to 1.64.0 I do not see an unresolved promise rejection error.


Technical Details:
Library & Version: analytics.js npm:next-1.66.0
Browser: Safari 17.4.1
Operating System: macOS 14.4.1


Note: I originally posted this issue here: segmentio/analytics.js-integrations#800. But felt it made more sense here now that it is analytics-next version specific.

@silesky
Copy link
Contributor

silesky commented Apr 24, 2024

@mwisner, does GTM actually load successfully (or not) in one version vs the other, or is it just a matter of the error now being surfaced?

My assumption is that GTM is blocked in both versions, but there's now some additional console spam -- but want to make sure!

@chrisradek
Copy link
Contributor

@mwisner Thank you for reporting this issue! The root cause was identified and fixed in #1076

Will be publishing a new version of analytics-next shortly!

@chrisradek chrisradek reopened this Apr 24, 2024
@chrisradek
Copy link
Contributor

@segment/analytics-next version 1.68.0 has been published to NPM and includes this fix. Thank you again for reporting! Please let us know if you still encounter this issue after updating!

@mwisner
Copy link
Author

mwisner commented Apr 24, 2024

Hi @silesky GTM/GA are getting blocked in both versions.

@chrisradek, thank you for the super quick turnaround! appreciate all your work!

@mwisner
Copy link
Author

mwisner commented Apr 24, 2024

Hi @chrisradek,

I just tried 1.68.0 and am still still getting the same error. One thing is we are using custom CDN. do you think that would be an issue?

@chrisradek
Copy link
Contributor

@mwisner I would expect to see the google tag manager error still, but are you still unable to send events to Segment?
Can you share which version of @segment/analytics-core is being pulled in as well?

@chrisradek
Copy link
Contributor

The separate CDN might change things slightly. When I test using the segment CDN, our google tag manager integration fails to load and is output as a warning:

Google Tag Manager
Error: Failed to load https://cdn.segment.com/next-integrations/integrations/google-tag-manager/2.5.1/google-tag-manager.dynamic.js.gz
(anonymous function) — load-script.ts:50

So, the google tag manager sdk won't even be fetched like in your case. However, that shouldn't prevent analytics.js from still sending events to other destinations, including Segment.io.

@mwisner
Copy link
Author

mwisner commented Apr 24, 2024

@chrisradek

[1/4] 🤔  Why do we have the module "@segment/analytics-core"...?
[2/4] 🚚  Initialising dependency graph...
[3/4] 🔍  Finding dependency...
[4/4] 🚡  Calculating file sizes...
=> Found "@segment/[email protected]"

We are seeing a situation where GA4 destination + Safari tracking protection is leading to no network requests for track, page, identify, etc. But that was on 1.64, 1.66, and 1.68. When I disable GAv4 destination it starts working again

@chrisradek
Copy link
Contributor

But that was on 1.64, 1.66, and 1.68.

Earlier you said:

When I downgrade to 1.64.0 I do not see an unresolved promise rejection error.

I'll try to reproduce the specific issue you're seeing - but can you confirm if it was there in 1.64.0?

@mwisner
Copy link
Author

mwisner commented Apr 24, 2024

Sorry, I think there are two issues. I was originally trying to first address the unresolved promise rejection error, and then I was going to raise a second separate issue around the tracking. I wasn't sure sure if the solution would be the same.

I just mentioned it in this thread because:

So, the google tag manager sdk won't even be fetched like in your case. However, that shouldn't prevent analytics.js from still sending events to other destinations, including Segment.io.

My bad, didn't mean to cause any confusion. Should have just raised them both at the same time.

Notes:
unresolved promise error

  • 1.64 (No unresolved promise error)
  • 1.66 (unresolved promise error)
  • 1.68 (unresolved promise error)

Unrelated GA4 issue no tracking issue
impacts 1.64, 1.66, 1.168.

if it would be of any help, I can open up a support case or email over links to our publically available preview urls. with the various versions deployed.

@chrisradek
Copy link
Contributor

@mwisner Gotcha - would be very helpful to have links to the preview urls if you can share them! I haven't been able to reproduce yet with simple network tab request blocking - working on setting up my own CDN proxy to test next. Support case is probably the best way - feel free to mention me (cradek) so it gets to me quicker!

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