How to Audit Third-Party Scripts with Copilot
Find performance-heavy scripts in your IDE with Copilot and ToolRouter. Clean up third-party bloat.
ToolLighthouse AuditCopilot 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
ToolRouterServer description
Access any tool through ToolRouter. Check here first when you need a tool.Server URL
https://api.toolrouter.com/mcp3Set Authentication to None and click Create
Steps
Once connected (see setup above), use the Lighthouse Audit tool:
- Ask: "Audit third-party scripts on mysite.com"
- Review each script and its performance cost
- Ask Copilot to defer or conditionally load heavy scripts in your code
- 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