Closed Bug 1801418 Opened 1 year ago Closed 1 year ago

Do not accidentally run the datalayer callbacks twice if SmartBlock's shim runs beside the real Tag Manager

Categories

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

defect

Tracking

()

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: twisniewski, Assigned: twisniewski)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

It is possible for a page to load Tag Manager, which isn't blocked, and then Analytics, which is blocked and shimmed. In that case, it's then possible for the shim to call the dataLayer functions a second time, after Tag Manager has already done so. This is causing elements on Apple Vacations to not be possible to click, because a second overlay for their chat client is added, but not disabled (since there is only supposed to be one such overlay).

We can fix this by just not re-running the data layer if GTM is already loaded, by changing this line into:

  if (Array.isArray(dl) && !dl.find(e => e["gtm.start"])) {

(At least I believe that's the most reliable way to detect whether GTM has begun to load).

Assignee: nobody → twisniewski
Status: NEW → ASSIGNED
Pushed by twisniewski@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4cf04628d82d
Do not accidentally run data layer callbacks twice if SmartBlock's shim runs after Tag Manager; r=ksenia,webcompat-reviewers
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch

(In reply to Pulsebot from comment #2)

Pushed by twisniewski@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4cf04628d82d
Do not accidentally run data layer callbacks twice if SmartBlock's shim runs
after Tag Manager; r=ksenia,webcompat-reviewers

== Change summary for alert #36210 (as of Mon, 28 Nov 2022 22:30:41 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
22% fandom loadtime windows10-64-shippable-qr bytecode-cached fission warm webrender 244.50 -> 189.62
19% fandom loadtime linux1804-64-shippable-qr bytecode-cached fission warm webrender 231.29 -> 187.29
13% fandom SpeedIndex windows10-64-shippable-qr bytecode-cached fission warm webrender 213.79 -> 185.33
13% fandom SpeedIndex windows10-64-shippable-qr bytecode-cached fission warm webrender 215.33 -> 186.92
12% fandom PerceptualSpeedIndex windows10-64-shippable-qr bytecode-cached fission warm webrender 180.62 -> 159.00

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=36210

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: