Code Coverage

Definition

Code coverage refers to how much of a website’s code is actually being used to render pages that users see. It measures the percentage of code that is executed when pages load. It is specially important for JavaScript and CSS files.

Code Coverage Relevance For SEO

Having higher code coverage is better for SEO because:

  • It helps pages load faster by removing unused code. This improves user experience and Google rankings.
  • Eliminating unused code reduces overall site code complexity. This makes it easier to maintain and update code over time.
  • Removing unused code eliminates potential security vulnerabilities that could get exploited.

Code Coverage Best Practices for SEO

Some best practices around code coverage analysis for SEO include:

  • Chose the Right Tools: Use tools like Sitebulb to audit code coverage across all site pages. Identify unused code to remove.
  • Have a Clear Goal: Set a target coverage percentage to aim for, like 90-95%+. Prioritize cleanup of lowest coverage pages first.
  • Create a Priority: Focus on analyzing coverage of critical pages and templates. Fixing issues there improves many pages.
  • Re-test coverage after major site changes to catch new unused code. Add to cleanup backlog.
  • Document reasons for keeping any known dead code instead of removing. Revisit this periodically.