This file describes all phantomas
modules (37 of them) and 191 metrics that they emit.
When applicable, offender example is provided.
Analyzes AJAX requests
number of AJAX requests (number, with offenders)
{
"url": "/static/style.css",
"method": "POST"
}
number of synchronous XMLHttpRequest (number, with offenders)
{
"url": "inline-css.html",
"method": "GET"
}
Meters number of invocations of window.alert, window.confirm, and window.prompt.
number of calls to window.alert (number, with offenders)
"Oh dear!"
number of calls to window.confirm (number, with offenders)
"Oh dear?"
number of calls to window.prompt (number, with offenders)
"What's your name, dear?"
Adds CSS complexity metrics using analyze-css npm module. Run phantomas with --analyze-css option to use this module
total length of base64-encoded data in CSS source (will warn about base64-encoded data bigger than 4 kB) (bytes, with offenders)
number of unique colors used in CSS (number, with offenders)
number of comments in CSS source (number, with offenders)
length of comments content in CSS source (bytes)
number of selectors with complex matching by attribute (e.g. [class$="foo"]) (number, with offenders)
number of declarations (e.g. .foo, .bar { color: red } is counted as one declaration - color: red) (number, with offenders)
number of CSS property definitions duplicated within a selector (number, with offenders)
number of CSS selectors defined more than once in CSS source (number, with offenders)
number of rules with no properties (e.g. .foo { }) (number, with offenders)
number of rules with CSS expressions (e.g. expression( document.body.clientWidth > 600 ? "600px" : "auto" )) (number, with offenders)
number of properties with value forced by !important (number, with offenders)
number of @import rules (number, with offenders)
number of inline styles (number)
length of CSS source (in bytes) (bytes, with offenders)
number of media queries (e.g. @media screen and (min-width: 1370px)) (number, with offenders)
number of selectors with multiple classes (e.g. span.foo.bar) (number, with offenders)
set to 1 if the provided CSS is not minified (number, with offenders)
number of fixes for old versions of Internet Explorer (e.g. * html .foo {} and .foo { *zoom: 1 }) (number, with offenders)
number of properties with no longer needed vendor prefix, powered by data provided by autoprefixer (e.g. --moz-border-radius) (number, with offenders)
number of CSS files (or embeded CSS) that failed to be parse by analyze-css (number, with offenders)
{
"url": "[inline CSS]",
"value": {
"message": "Empty sub-selector",
"position": {
"end": {
"column": 43,
"line": 2
},
"source": "undefined",
"start": {
"column": 14,
"line": 2
}
}
}
}
number of qualified selectors (e.g. header#nav, .foo#bar, h1.title) (number, with offenders)
number of redundant body selectors (e.g. body .foo, section body h2, but not body > h1) (number, with offenders)
number of rules (e.g. .foo, .bar { color: red } is counted as one rule) (number, with offenders)
average length of selector (e.g. for .foo .bar, #test div > span { color: red }
will be set as 2.5) (number, with offenders)
number of selectors (e.g. .foo, .bar { color: red } is counted as two selectors - .foo and .bar) (number, with offenders)
number of selectors by attribute (e.g. .foo[value=bar]) (number)
number of selectors by class (number)
number of selectors by ID (number)
number of pseudo-selectors (e,g. :hover) (number)
number of selectors by tag name (number)
average specificity for class, pseudo-class or attribute (number, with offenders)
total specificity for class, pseudo-class or attribute (number)
average specificity for ID (number, with offenders)
total specificity for ID (number)
average specificity for element (number, with offenders)
total specificity for element (number)
number of redundant child nodes selectors (number, with offenders)
Adds Responsive Images metrics using analyze-images npm module. Run phantomas with --analyze-images option to use this module
number of images that could be served smaller as the human eye can hardly see the difference (number, with offenders)
number of loaded images that could be lighter it optimized (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/example.svg",
"fileSize": 464,
"newFileSize": 290
}
number of loaded images that could benefit from new generation formats (WebP or AVIF) (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/mdn.png",
"fileSize": 20386,
"newFileSize": 7011,
"webpSize": 10876,
"avifSize": 7011
}
number of loaded images scaled down when displayed (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/mdn.png?nocache=1",
"fileSize": 18462,
"naturalWidth": 600,
"naturalHeight": 529,
"newFileSize": 6793,
"newWidth": 300,
"newHeight": 265,
"dpr": 1
}
number of responsive images with an improperly set sizes parameter (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/mdn.png?nocache=6",
"sizesAttribute": "calc(99vw - 3px - 1em)",
"convertedInPx": 773,
"displayWidth": 300
}
number of nodes without both width and height attribute (number, with offenders)
{
"path": "img#img",
"src": "http://0.0.0.0:8888/static/mdn.png"
}
Analyzes number of requests and sizes of different types of assets
number of base64 encoded "responses" (no HTTP request was actually made) (number, with offenders)
size of base64 encoded responses (bytes)
number of CSS responses (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/style.css",
"size": 320
}
size of CSS responses (with compression) (bytes)
number of HTML responses (number, with offenders)
{
"url": "http://127.0.0.1:8888/dom-operations.html",
"size": 946
}
size of HTML responses (with compression) (bytes)
number of image responses (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/blank.gif",
"size": 342
}
size of image responses (with compression) (bytes)
number of JS responses (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/jquery-2.1.1.min.js",
"size": 29734
}
size of JS responses (with compression) (bytes)
number of JSON responses (number, with offenders)
{
"url": "http://127.0.0.1:8888/foo.json",
"size": 345
}
size of JSON responses (with compression) (bytes)
number of other responses (number, with offenders)
{
"url": "http://0.0.0.0:8888/favicon.ico",
"size": 103
}
size of other responses (with compression) (bytes)
number of video responses (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/stickman.webm",
"size": 3750
}
size of video responses (with compression) (bytes)
number of web font responses (number, with offenders)
size of web font responses (with compression) (bytes)
Aborts requests to external resources or given domains Does not emit any metrics
number of requests blocked due to domain filtering (number, with offenders)
"http://code.jquery.com/jquery-1.11.1.js"
Analyzes Age and X-Cache headers from caching servers like Squid or Varnish
number of cache hits (number, with offenders)
number of cache misses (number, with offenders)
number of cache passes (number, with offenders)
Analyzes HTTP caching headers
number of responses with caching disabled (max-age=0) (number, with offenders)
"http://0.0.0.0:8888/static/mdn-no-cache.png"
number of responses with no caching header sent (no Cache-Control header) (number, with offenders)
"http://0.0.0.0:8888/static/jquery-1.4.4.min.js"
number of responses with too short (less than a week) caching time (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/mdn.png",
"ttl": 86400
}
number of responses with a long TTL that can benefit from Cache-Control: immutable (number, with offenders)
{
"url": "http://code.jquery.com/jquery-1.4.4.js",
"ttl": 315360000
}
number of responses with old, HTTP 1.0 caching headers (Expires and Pragma) (number, with offenders)
{
"url": "http://0.0.0.0:8888/_make_docs.html",
"headerName": "expires",
"value": "Wed, 16 Aug 2023 12:28:56 GMT"
}
Meters number of console logs
number of calls to console.* functions (number, with offenders)
"log:[\"Hi!\"]"
cookies metrics
length of cookies received in HTTP responses (bytes)
length of cookies sent in HTTP requests (bytes)
number of cookies in document.cookie (number)
length of document.cookie (bytes)
number of domains with cookies set (number, with offenders)
total number of full or partial page layout (number)
combined durations of all page layouts (ms)
total number of page style recalculations (number)
combined duration of style recalculations (ms)
combined duration of JavaScript execution (ms)
combined duration of all tasks performed by the browser (ms)
Measure document height
the page height (px)
Analyzes DOM complexity
maximum level on nesting of HTML element node (number, with offenders)
"body > script[0]"
total number of HTML element nodes (number)
number of duplicated IDs found in DOM (number, with offenders)
{
"id": "img",
"count": 2
}
the size of body tag content (document.body.innerHTML.length) (bytes)
the size of HTML comments on the page (bytes, with offenders)
number of iframe nodes (number, with offenders)
{
"element": "body > iframe[1]",
"url": "http://127.0.0.1:8888/image-scaling.html"
}
number of nodes with inline CSS styling (with style attribute) (number, with offenders)
{
"css": "color: blue",
"node": "p#foo"
}
the size of text nodes with whitespaces only (bytes)
Analyzes DOM hidden content
hiddenContentSize
the size of content of hidden elements on the page (with CSS display: none) (bytes, with offenders)
hiddenImages
number of hidden images that can be lazy-loaded (number, with offenders)
"http://127.0.0.1:8888/static/mdn.png"
Analyzes DOM changes via MutationObserver API
number of DOM nodes attributes changes (number, with offenders)
{
"attribute": "style",
"node": "body"
}
number of node inserts (number, with offenders)
{
"node": "strong[0]",
"target": "p#foo"
}
number of node removes (number, with offenders)
{
"node": "span#delete",
"target": "body"
}
Analyzes DOM queries done via native DOM methods
number of DOM nodes inserts (number, with offenders)
{
"append": "html > div[2]",
"node": "html"
}
number of all DOM queries (number, with offenders)
number of repeated uses of a duplicated query (number)
number of document.getElementsByClassName calls (number, with offenders)
{
"class": "barr",
"node": "body"
}
number of document.getElementById calls (number, with offenders)
{
"id": "foo",
"node": "#document"
}
number of document.querySelector(All) calls (number, with offenders)
{
"selector": ".TEST",
"node": "div"
}
number of document.getElementsByTagName calls (number, with offenders)
{
"tag": "*",
"node": "div"
}
number of DOM queries called more than once (number, with offenders)
{
"query": "id \"#foo\" (in #document)",
"count": 2
}
number of DOM queries that returned nothing (number, with offenders)
{
"query": "#script1692102537022",
"node": "#document",
"function": "getElementById"
}
Domains monitor
number of domains used to fetch the page (number, with offenders)
{
"domain": "127.0.0.1",
"requests": 2
}
maximum number of requests fetched from a single domain (number)
median of number of requests fetched from each domain (number)
Analyzes events bound to DOM elements
number of EventTarget.addEventListener calls (number, with offenders)
{
"eventType": "load",
"path": "window"
}
number of EventTarget.dispatchEvent calls (number, with offenders)
{
"eventType": "click",
"path": "body > div#foo > span.bar"
}
number of scroll event bounds (number, with offenders)
{
"element": "#document"
}
Counts global JavaScript variables
number of JS globals variables (number, with offenders)
"jQuery"
number of JS globals variables with falsy value (number, with offenders)
{
"name": "falsy",
"value": false
}
Analyzes HTTP headers in both requests and responses
number of responses with headers part bigger than the response body (number, with offenders)
number of requests and responses headers (number)
number of headers received in responses (number)
size of received headers (bytes)
number of headers sent in requests (number)
size of sent headers (bytes)
size of all headers (bytes)
Analyzes jQuery activity
number of DOM read operations (number, with offenders)
{
"functionName": "css",
"arguments": "[\"color\"]",
"contextPath": "body > div#foo > span.bar"
}
number of read operations that follow a series of write operations (will cause repaint and can cause reflow) (number, with offenders)
{
"functionName": "css",
"arguments": "[\"color\"]",
"contextPath": "body > div#foo > span.bar"
}
number of DOM write operations (number, with offenders)
{
"functionName": "css",
"arguments": "[{\"color\":\"red\",\"background\":\"green\"}]",
"contextPath": "body > div#foo > span.bar"
}
number of jQuery event triggers (number, with offenders)
{
"type": "click",
"element": "body > div#foo > span.bar"
}
number of functions bound to onDOMReady event (number, with offenders)
"HTMLDocument.DOMContentLoaded (http://code.jquery.com/jquery-1.4.4.js:875:10)"
number of calls to Sizzle (including those that will be resolved using querySelectorAll) (number, with offenders)
{
"selector": "#foo .bar",
"element": "#document"
}
version of jQuery framework (if loaded) (string)
number of loaded jQuery "instances" (even in the same version) (number, with offenders)
{
"version": "2.1.1",
"url": "http://127.0.0.1:8888/static/jquery-2.1.1.min.js"
}
number of functions bound to windowOnLoad event (number, with offenders)
"http://127.0.0.1:8888/jquery.html:49:13"
Reports the use of functions known to be serious performance bottlenecks in JS Run phantomas with --spy-eval to count eval() calls (see issue #467)
number of calls to either document.write or document.writeln (number, with offenders)
{
"message": "document.write() used",
"caller": "http://127.0.0.1:8888/bottlenecks.html:11:11"
}
number of calls to eval (either direct or via setTimeout / setInterval) (number, with offenders)
{
"message": "eval() called directly",
"caller": "http://127.0.0.1:8888/bottlenecks.html:8:2"
}
Meters the number of page errors, and provides traces as offenders for "jsErrors" metric
number of JavaScript errors (number, with offenders)
"unknown_function_called is not defined - "
Analyzes if HTTP responses keep the connections alive.
number of requests not keeping the connection alive and slowing down the next request (number, with offenders)
Analyzes images and detects which one can be lazy-loaded (are below the fold)
number of images displayed below the fold that can be lazy-loaded (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/blank.gif",
"node": "body > img#dot",
"offset": 900
}
localStorage metrics
number of entries in local storage (number, with offenders)
"foo"
Analyzes bits of data pertaining to the main request only
comma-separated list of HTTP status codes that main request followed through (could contain a single element if the main request is a terminal one) (string)
Emits "milestone" event on Navigation Timing related events:
- domContentLoaded
- domInteractive
- domComplete Code taken from windowPerformance module
Checks versions of HTTP and TLS protocols
HTTP protocol used by the main domain (string)
TLS protocol used by the main domain (string)
number of domains using HTTP/1.0 or 1.1 (number, with offenders)
{
"domain": "https://127.0.0.1",
"httpVersion": "http/1.1",
"requests": 2
}
number of domains using TLS 1.2 (number, with offenders)
{
"domain": "https://127.0.0.1",
"tlsVersion": "TLS 1.2",
"beforeDomReady": true
}
Analyzes HTTP redirects
number of HTTP redirects (either 301, 302 or 303) (number, with offenders)
time it took to send and receive redirects (ms)
Simple HTTP requests monitor and analyzer
size of the uncompressed content of all responses (bytes)
size of the compressed content of all responses, i.e. what was transfered in packets (bytes)
number of gzipped HTTP responses (number, with offenders)
{
"url": "http://127.0.0.1:8888/dom-operations.html",
"bodySize": 2094,
"transferedSize": 946
}
time it took to receive the last byte of the last HTTP response (ms)
number of HTTPS requests (number, with offenders)
number of HTTP 404 responses (number, with offenders)
"http://127.0.0.1:8888/not_found/foo.js"
number of POST requests (number, with offenders)
"http://127.0.0.1:8888/static/style.css"
total number of HTTP requests made (number, with offenders)
{
"url": "http://127.0.0.1:8888/not-found.html",
"type": "html",
"size": 380
}
Analyzes HTTP requests and generates stats metrics
the time to the first byte of the slowest response (ms, with offenders)
{
"url": "http://0.0.0.0:8888/static/mdn-short-cache.png",
"timeToFirstByte": 31.697000000000003
}
the size of the biggest response (bytes, with offenders)
{
"url": "http://127.0.0.1:8888/headers.html",
"size": 856
}
the time to the last byte of the fastest response (ms, with offenders)
{
"url": "http://0.0.0.0:8888/foo.json",
"timeToLastByte": 0.004929000046104193
}
median value of time to the first byte for all responses (ms, with offenders)
median value of time to the last byte for all responses (ms, with offenders)
the time to the last byte of the slowest response (ms, with offenders)
{
"url": "http://code.jquery.com/jquery-1.4.4.js",
"timeToLastByte": 0.08683400019071996
}
the time to the first byte of the fastest response (ms, with offenders)
{
"url": "http://0.0.0.0:8888/foo.json",
"timeToFirstByte": 3.077
}
the size of the smallest response (bytes, with offenders)
{
"url": "http://127.0.0.1:8888/static/blank.gif",
"size": 342
}
Number of requests it took to make the page enter DomContentLoaded and DomComplete states accordingly
number of domains used to make the page reach DomComplete state (number, with offenders)
{
"domain": "127.0.0.1",
"requests": 2
}
number of domains used to make the page reach DomContentLoaded state (number, with offenders)
{
"domain": "127.0.0.1",
"requests": 2
}
number of domains used to make the first paint (number, with offenders)
number of HTTP requests it took to make the page reach DomComplete state (number)
number of HTTP requests it took to make the page reach DomContentLoaded state (number)
number of HTTP requests it took to make the first paint (number)
Analyzes static assets (CSS, JS and images)
number of static assets that were not gzipped (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/jquery-1.4.4.min.js",
"contentType": "application/javascript"
}
number of static assets requested from domains with cookie set (number, with offenders)
number of static assets requested with query string (e.g. ?foo) in URL (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/mdn.png?cb=123",
"contentType": "image/png"
}
number of static assets that are requested more than once (number, with offenders)
number of CSS assets smaller than 2 KiB that can be inlined or merged (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/style.css",
"size": 320
}
number of images smaller than 2 KiB that can be base64 encoded (number, with offenders)
{
"url": "http://127.0.0.1:8888/static/blank.gif",
"size": 342
}
number of JS assets smaller than 2 KiB that can be inlined or merged (number, with offenders)
Provides metrics for time to first image, CSS and JS file
time it took to receive the last byte of the first CSS (ms, with offenders)
time it took to receive the last byte of the first image (ms, with offenders)
"http://0.0.0.0:8888/static/mdn.png received in NaN ms"
time it took to receive the last byte of the first JS (ms, with offenders)
"http://0.0.0.0:8888/static/jquery-1.4.4.min.js received in NaN ms"
Takes a look at "time to first (last) byte" metrics
time it took to receive the first byte of the first response (that was not a redirect) (ms)
time it took to receive the last byte of the first response (that was not a redirect) (ms)
Measure when the page reaches certain states
time it took to load all page resources, the loading spinner has stopped spinning (ms)
time it took to construct both DOM and CSSOM, no stylesheets that are blocking JavaScript execution (i.e. onDOMReady) (ms)
time it took to finish handling of onDOMReady event (ms)
time it took to parse the HTML and construct the DOM (ms)
time it took to connect to the server before making the first HTTP request (ms)
time it took to resolve the domain before making the first HTTP request (ms)
time it took to fully load the page (ms)
time it took to receive the first byte of the first HTTP response (ms)
time to the first byte compared to the total loading time (%)
time to window.load compared to the total loading time (%)
This file is auto-generated from code comments. Please run
npm run make-docs
to update it.