Skip to content

Tech detection: script-url detectors stop seeing inline-loader URLs (Clarity snippet) once a page has script bodies attached #1430

Closed

Description

@nc9

What happens

A script-url detector matches a page's HTML only when that page has no script bodies attached. Once buildTechInputs attaches a body, the page gets a scripts array, and matchDetector then tests only the listed URLs (<script src> values and stored scripts). A URL that the page loads from an inline snippet is no longer seen.

The standard Microsoft Clarity install is such a snippet: it builds the www.clarity.ms/tag/<id> URL inside an inline <script>, so the raw HTML has no <script src> for it. Clarity's other detector, clarity("set", is not in that snippet either.

So whether Clarity is detected depends on the byte caps, not the site. Under the corpus caps (256 KB per bundle, 1 MB per audit) the later pages of a big site get no bodies, fall back to the HTML, and find clarity.ms. Under the local scan's whole-bundle reading (#1387, v0.0.147) every page gets bodies, and the same sites lose Clarity.

Offline re-run over a stored corpus (33,416 single-launch sites, identical stored pages and scripts, engines differ only):

  • Clarity: 1,240 sites on v0.0.140/v0.0.146 caps, 1,216 with v0.0.147 local-scan options. 24 lost, none gained.
  • On the 6 lost sites checked, clarity.ms appears on every stored page and only inside inline script text, never in a <script src>. The home page, which always gets bodies, never matched on any engine.
  • Contentful lost 10 sites the same way (script-url /contentful/i stops scanning the HTML). Some of those were probably prose matches, which the fallback should not have accepted either.

Acceptance Criteria

  • Clarity installed with the standard inline snippet (no <script src> for clarity.ms in the HTML) is detected on a page that also has script bodies attached.
  • Whether a script-url detector matches no longer depends on whether that page had bodies attached: the same page gives the same result under the cloud caps and the local scan.
  • A test covers a page with an attached body plus an inline loader snippet for a third-party script URL.
  • A prose mention of a vendor name in page text is not reported as that vendor's script.

Related: #1387, #1420.

nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsize: S

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions