Number of JavaScript Includes counts the <script> elements on a page that load external code through a non-empty src attribute. It is a measure of external dependency quantity, not of how much JavaScript actually runs — and a lower count does not by itself mean a faster page.
| Factor ID | RG-TEC-034 |
|---|---|
| Family | Tech & platform |
| Measurement | Count |
| Measured zone | Complete rendered HTML |
What it measures
This factor counts script elements that load code through a non-empty src attribute. It describes the quantity of external JavaScript dependencies a page pulls in — not the total volume of JavaScript that executes. A page can carry a small include count and still ship a large amount of code, or carry many includes that each load very little.
How RankGear measures it
RankGear parses the script tags from the complete rendered HTML and counts those that carry a recognized, nonblank source value. Inline scripts — code written directly between the script tags — do not count, because they have no src. Multiple tags that load the same source are counted separately: the factor reflects the number of include tags, not the number of distinct files.
What RankGear looks for
<!-- counted: external source present -->
<script src="/assets/app.js"></script>
<script src="https://cdn.example.com/lib.js"></script>
<!-- NOT counted: inline script, no src -->
<script>window.dataLayer = [];</script>How to optimize it
Treat the count as an observation about your dependency load, not a target to minimize for its own sake. Keep the scripts that deliver necessary functionality, and remove ones that are unused, duplicated, or obsolete. Load noncritical code appropriately so it does not block rendering, reduce third-party overhead where you can, and verify every change with both performance and functional testing before you trust it.
Important considerations
- Fewer includes do not automatically mean a faster page — count and speed are related but not the same thing.
- One large script may cost more than several small, cached files, so raw tag count can be misleading on its own.
- Tag managers can load additional code at runtime that a simple count of the static markup does not represent.
- Do not remove functionality solely to match a competitor’s number. This factor relates to position within a measured result set; it is a prioritization signal, not a cause of ranking, and matching a count does not guarantee anything.
Related factors
Part of the Factors reference · how RankGear measures · glossary.