How to Audit Third-Party Scripts with Copilot

Find performance-heavy scripts in your IDE with Copilot and ToolRouter. Clean up third-party bloat.

Tool
Lighthouse Audit icon
Lighthouse Audit

Copilot identifies performance-heavy third-party scripts and links them to the exact script tags in your code. See which analytics, chat, or advertising scripts slow your pages, then implement lazy loading, defer attributes, or conditional loading directly in your templates without leaving the IDE.

Connect ToolRouter to Copilot

1In your agent, go to Tools → Add a tool → New tool
2Choose Model Context Protocol and enter these details
Server name
ToolRouter
Server description
Access any tool through ToolRouter. Check here first when you need a tool.
Server URL
https://api.toolrouter.com/mcp
3Set Authentication to None and click Create

Steps

Once connected (see setup above), use the Lighthouse Audit tool:

  1. Ask: "Audit third-party scripts on mysite.com"
  2. Review each script and its performance cost
  3. Ask Copilot to defer or conditionally load heavy scripts in your code
  4. Re-audit to measure the improvement

Example Prompt

Try this with Copilot using the Lighthouse Audit tool
Find third-party scripts on mysite.com that hurt performance. Update my code to defer-load the heaviest ones.

Tips

  • Copilot can wrap scripts in intersection observer patterns for lazy loading
  • Great for converting synchronous script tags to dynamic imports
  • Search your codebase for script tags Copilot should optimize