Closed Bug 1618108 Opened 4 years ago Closed 3 years ago

Firefox "tracking protection" delays/slows down page navigation (click handler) on wingtra.com

Categories

(Core :: Privacy: Anti-Tracking, defect, P3)

74 Branch
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: david.perroud, Unassigned)

References

()

Details

(Whiteboard: [tp-shim-complex][tp-site-ephemeral])

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:74.0) Gecko/20100101 Firefox/74.0

Steps to reproduce:

  1. Activate "Strict" protection in Firefox Privacy settings
  2. Go to a website which has Event tracking from Google Tag Manager (eg. https://wingtra.com/)
  3. Click on an item in the big menu navigation

Actual results:

--> Page load is delayed, nothing happens during a few seconds, then the page load starts

Expected results:

--> When "Strict" is deactivated in privacy settings, the page loads immediately, without delay

Has STR: --- → yes
Component: Untriaged → Privacy: Anti-Tracking
Product: Firefox → Core

This appears to be a known issue that results from blocking GTM. See https://bugzilla.mozilla.org/show_bug.cgi?id=1516552#c15. Once we have a fix for that landed we should verify that the delay is also fixed for this site.

Blocks: tp-breakage
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
See Also: → 1516552

I can't reproduce this... I think now that Google Tag Manager isn't blocked in the Disconnect list this bug may not happen any more?

Hi (In reply to :ehsan akhgari from comment #3)

I can't reproduce this... I think now that Google Tag Manager isn't blocked in the Disconnect list this bug may not happen any more?

Yes the bug still happens

Could you try by clicking on a sub-navigation item (this is where the GTM event tracking is activated). The main navigation items are not tracked.

e.g Why Wingtra > Take off and land vertically (VTOL)
or Drone > Cameras

Yeah, I still can't reproduce. What version of Firefox are you using? Could you please go to about:url-classifier, enter https://www.googletagmanager.com/gtm.js?id=GTM-TLFT2HW for URL and click on "Start searching" and see what if anything appears under Results? Thanks!

(In reply to :ehsan akhgari from comment #5)

Yeah, I still can't reproduce.

I'm still seeing the arbitrary delay (with strict tracking enabled) at https://www.theverge.com/ , FWIW (see bug 1516552 comment 35, profile link there). And I do see that we're blocking "googletagservices.com" (not manager) as a tracking domain. Maybe that's the one involved in introducing this delay? (not sure)

Sorry, it looks like the symptoms here (delayed response to a click) are unrelated to the "async-hide" thing in bug 1516552 (which is delayed initial pageload). So comment 6 is a bit off-topic.

Having said that -- I can reproduce this bug. Here's a profile: https://perfht.ml/39DiMWN

Note that I click the link (for "Drone | WingtraOne Drone") at around t=1.2 seconds in this profile, and no navigation happens (the tab throbber doesn't even start spinning) until 2 seconds later, at t=3.2 seconds.

Here's a zoomed-in view of when the navigation starts (around 3.2s) -- it's kicked off by a 2-second setTimeout callback:
https://perfht.ml/2TqtMAT

(So, this 2-second delay is clearly "graceful fallback" for some analytics API that's failing to run&navigate due to being blocked by strict tracking protection. Per comment 3, it's probably not literally googletagmanager.com but it may be some other Google tag/analytics bundle.)

Also: it looks like the setTimeout itself is being fired by the script https://www.googletagmanager.com/gtm.js?id=GTM-TLFT2HW . Here's a zoomed-in view of when I click the link, with the stack filtered for setTimeout: https://perfht.ml/38umK2i

If you expand that all the way down, you can see that it's https://www.googletagmanager.com/gtm.js?id=GTM-TLFT2HW line 599 that is making the call.

Here's the entire contents of that line of script (line 599):

var He=function(a,b,c){Be[a]={tags:[]};ra(b)&&Fe(a,b);c&&D.setTimeout(function(){return Ee(a)},Number(c));return Ge(a)},Fe=function(a,b){Ae[a]=Ae[a]||[];Ae[a].push(Ia(function(){return G(function(){b(Wc.s,Be[a])})}))};function Ge(a){var b=0,c=0,d=!1;return{add:function(){c++;return Ia(function(){b++;d&&b>=c&&Ee(a)})},Af:function(){d=!0;b>=c&&Ee(a)}}};var Ie=function(){function a(d){return!sa(d)||0>d?0:d}if(!I._li&&D.performance&&D.performance.timing){var b=D.performance.timing.navigationStart,c=sa(Md.get("gtm.start"))?Md.get("gtm.start"):0;I._li={cst:a(c-b),cbt:a(cd-b)}}};var Me={},Ne=function(){return D.GoogleAnalyticsObject&&D[D.GoogleAnalyticsObject]},Oe=!1;

Notably:

  • It does call setTimeout (so it makes sense that this is where that 2-second setTimeout delay is coming from)
  • It references GoogleAnalyticsObject (so there may be an implicit "soft" dependency on Google Analytics here)

Google Analytics is still classified as a tracker in the Disconnect lists, so it gets blocked in strict mode. Given it's referenced alongside the gtm.js setTimeout here, I would bet that blockage is the source of the problem here. The page [via GTM] is probably trying to do something via Google Analytics, and has a 2 second "graceful" fallback, if that fails (and it does fail, since Google Analytics is blocked).

So: similar to bug 1516552 indeed, which (per bug 1516552 comment 37) can also chalk its symptoms up to Google Analytics being blocked.

I see, thanks a lot for digging into this.

Yes I see the 2 seconds delay due to GTM waiting for other Tags to fire. Now I understand, as GA is blocked, then this 2 seconds delay happens.

However is that even though I remove this delay in GTM, the issue still occurs. (I did remove it now for the navigation links)

Oh, I just noticed @wingtra in your email address. :) I hadn't realized you were a developer at the affected site. That's handy!

I'm not sure we have further debugging resources to offer, at this point, beyond telling you that this is something in your own code (well, your code plus GTM) that's doing this (when Google Analytics is blocked or fails to load).

Allright, thanks a lot for helping so far. Then guess we can close the ticket.

So far we won't invest resources from our side either, as this seems to happen only to visitors with strict privacy settings on Firefox activated.

Thank you :)

(In reply to david.perroud from comment #12)

Allright, thanks a lot for helping so far. Then guess we can close the ticket.

So far we won't invest resources from our side either, as this seems to happen only to visitors with strict privacy settings on Firefox activated.

Thank you :)

Thanks for understanding and sorry to hear that you weren't able to fix your site.

We'll keep this issue open because we'd like to know which sites are broken when parties like GA are blocked, and whether we can do anything automated to fix them.

This sounds related to Google's asynchide technique (see bug 1478593), but the page is loading fine for me and I don't see them using asynchide in their markup, so I guess all that's left is to mark this as worksforme.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WORKSFORME

I can still reproduce.

This isn't an "asynchide"-style issue -- it's a delay in navigation, when you click a menu item. (Nothing happens for several seconds, and then then all of a sudden the navigation starts.) There's an artificial delay in the click-handler, or something.

e.g. visit https://wingtra.com/ , hover "DRONE" menu near top left, and choose the first option, "WingtraOne Drone". If I have strict tracking protection enabled, then there's a few-second delay before the navigation starts (as can be seen via the favicon pulsing, etc.)

Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Summary: Firefox "tracking protection" delays/slows down page load on website with Google Tag Manager Event tracking → Firefox "tracking protection" delays/slows down page navigation (click handler) on website with Google Tag Manager Event tracking

Ah, thanks for that, Dan!

It's similar to asyncHide, but messier. I added some logging to see where setTimeouts are called that are longer than a second, and sure enough this delay is coming from Google Tag Manager, in the script https://www.googletagmanager.com/gtm.js?id=GTM-TLFT2HW, in this function:

var nh=function(a,b,c){hh[a]={tags:[]};Da(b)&&lh(a,b);c&&D.setTimeout(function(){return kh(a)},Number(c));

If I re-write that script to replace Number(c) with 5, the delay goes away.

So we should be able to shim this by rewriting GTM responses, though it could be tricky work. Alternatively we could probably just shim its use of setTimeout to cap any delays that it makes, but this could lead to other breakage if we're not careful.

Whiteboard: [tp-shim-complex][tp-site-ephemeral]

This delay no longer reproduces for me regardless of shims, despite the site using the asynchide snippet.

Status: REOPENED → RESOLVED
Closed: 4 years ago3 years ago
Resolution: --- → FIXED
Summary: Firefox "tracking protection" delays/slows down page navigation (click handler) on website with Google Tag Manager Event tracking → Firefox "tracking protection" delays/slows down page navigation (click handler) on wingtra.com

Actually, I was probably wrong here. Reopening to verify again.

Status: RESOLVED → REOPENED
Resolution: FIXED → ---

No, it seems to be fixed, I was just seeing things.

Status: REOPENED → RESOLVED
Closed: 3 years ago3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.