mozilla / blok

Web Extension implementation of Firefox tracking protection for experimental development
https://public.etherpad-mozilla.org/p/tracking-protection-coordination
Mozilla Public License 2.0
25 stars 21 forks source link

Shim requests for utag.js with a no-op utag.view response script #216

Closed groovecoder closed 7 years ago

groovecoder commented 8 years ago

In our breakage analysis in #204, we noted that users reported broken videos on multiple sites that use Tealium's utag.js script for video views. (E.g., weather.com)

When a user visits a page that makes a request for utag.js, shim the response with script that provides no-op utag.view (and utag.link?), so that no JS errors are raised on the page.

groovecoder commented 7 years ago

Okay, I got the shim working and it does prevent the ReferenceError: utag is not defined error. There are some complications:

  1. Bug: Add-on code can't currently load moz-extension:// resources (lost the bug number on this, but I'll find it and update here), so I had to push the shim up to a GitHub Pages fork & branch. Until that bug is fixed, we will have to push shim JS resources up to another static server or ship them in an accessible resource location. (Either in an add-on or in the platform)

  2. The shim seems to have a negligible effect that varies by how each domain implements it.

    • weather.com: prevents ReferenceErorr, but another error on the page still causes an infinite"Loading..." message.
    • cbs.com: preventsReferenceError and infinite spinner on cbs.com, but when the video starts to play, it says: "This video is unavailable because we were unable to load a message from our sponsors. If you are using ad blocking software please disable it and reload the page."
    • cnet.com: prevents ReferenceError, but another error on the page still causes an infinite "Loading..." message.
    • cbsnews.com: Page doesn't seem to source the script like the other domains, so the shim doesn't work. No ReferenceError, but the main.js script of the page errors: Error: Script error for "//tags.tiqcdn.com/utag/cbsi/cbsnewssite/prod/utag.js", needed by: managers/ad, managers/click-tracking, managers/tealium, components/video/video-uvpjs http://requirejs.org/docs/errors.html#scripterror

So, in summary, a shimming tactic:

@johngruen @fmarier - what do you think? Is it worth adding this and measuring overall video breakage with & without the shim? My hypothesis is that the shim will have no effect on reported video breakage, because of the issues above. But I'm happy to experiment and be surprised by observational data.

fmarier commented 7 years ago

It sounds like this approach isn't going to work in practice. Doing a site-specific shim to work around bugs in a single site's implementation isn't going to scale.

I'd say it's probably not worth pursuing this.

groovecoder commented 7 years ago

@fmarier is our expert. 😄 Closing this one. I'll look thru our list to see if there something else on which we might iterate in the experiment.