Plugins loading external assets
- Third-party
Problem Summary
Plugins often load external assets (CSS, JS, fonts, tracking scripts) on every page, even when not needed. This includes analytics, tracking pixels, social scripts, and external fonts.
Performance Impact
- Third-party requests: External scripts slow load
- Render blocking: External JS blocks rendering
- Privacy concerns: Users load scripts from third parties
- No caching benefit: External scripts aren’t cached locally
How to Detect
- PageSpeed Insights: Flags third-party code
- Chrome DevTools Network: Shows external requests
- GTmetrix: Lists third-party scripts
Solutions
1. Dequeue Unnecessary Scripts
<?php
add_action('wp_enqueue_scripts', function() { wp_dequeue_script('some-plugin-script'); wp_dequeue_style('some-plugin-style');}, 100);2. Delay JavaScript
Use defer or async for non-critical scripts.
3>Load Conditionally
if (is_page('contact')) { wp_enqueue_script('contact-form');}4>Use Local Analytics
Consider self-hosted analytics like Matomo.
5>Review Active Plugins
Deactivate plugins loading unnecessary assets.