HomeMethod

Knowledge

Web VitalsTechniquesSnippetsAnswersImpactsBottlenecks

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

  1. PageSpeed Insights: Flags third-party code

  2. Chrome DevTools Network: Shows external requests
  3. GTmetrix: Lists third-party scripts

Solutions

1. Dequeue Unnecessary Scripts

Code
<?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

Code
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.

Further Reading

Support our family now