Skip to main content
JUMP TO:Quick StartCLI CommandsConfigurationPlaywright APIMCP ServerGitHub Actions
Guides / Third-Party Script Monitoring(16 of 37)

Third-Party Script Monitoring

LOCAL PLUGIN. The plugin inventories third-party script origins and compares the stored inventory between runs.

Track every external <script src> origin loaded across your routes and spot unexpected third-party marketing tags, chat widgets, or supply-chain drift alongside visual diffs.

9-Hook Plugin Architecture and Third-Party Script Inventory
FIG 01 · UNIFIED RENDER AUDITS — THIRD-PARTY SCRIPT ORIGIN INVENTORY & DRIFT DETECTION

Import

frontguard.config.ts
import { createThirdPartyScriptPlugin } from '@frontguard/cli/plugins'

export default {
  version: 1,
  baseUrl: 'http://localhost:3000',
  plugins: [createThirdPartyScriptPlugin()],
}

Behavior

During the afterRender hook on each route, the plugin inspects all script elements with external origins, normalizes their hostnames, and compares them against the previous inventory snapshot stored in your project. Newly introduced external script origins are highlighted in the run report.

Pairing with blockUrls

When third-party scripts introduce visual flakiness (such as A/B testing flicker or floating customer-support bubbles), add their patterns to blockUrls in frontguard.config.ts so Playwright aborts them before screenshot capture:

frontguard.config.ts: blocking flaky third-party origins
export default {
  version: 1,
  baseUrl: 'http://localhost:3000',
  blockUrls: [
    '*widget.intercom.io*',
    '*cdn.segment.com*',
    '*optimize.google.com*',
  ],
  plugins: [createThirdPartyScriptPlugin()],
}

Limit

An origin change is evidence to review, not proof that a script is malicious or that it caused a layout regression.