Methods
The following methods can be called using the global edgemesh
variable in your own javascript or from the developer tools javascript console.
setLogLevel
SILENT | Disables all Edgemesh® logs. |
ERROR | Log only errors. |
WARN | Log warnings and errors. |
INFO | Log information, warnings, and errors. |
INFO | Log all logs, including verbose debugging logs. |
setDevMode
Enable and disable developer mode. Developer mode disables the Edgemesh service worker for your browser, allowing you to effectively bypass the Edgemesh Cache until developer mode is disabled.
Arguments
setDebugMode
Enable and disable debug mode. Debug mode is a tool for Edgemesh support that changes the data transport to a human-readable format.
Arguments
loadScripts
The loadScripts method is responsible for querying the DOM for scripts optimized with the Script Loader and processing them. It is automatically invoked when the Edgemesh® Client loads. However, we provide the flexibility for you to call it programmatically when necessary.
getStats
The getStats method returns a dictionary of Edgemesh relevant statistics. This is useful for integrating with third-party analytics platforms. This method is best called after the onload
or onpageshow
events to ensure all resources are captured.
Returns
flare
metrics
The Edgemesh® Client real user metrics can be accessed via the edgemesh.metrics
namespace and integrated with other workflows/reporters.
getTTFB
Time to First Byte (TTFB) is a foundational metric for measuring connection setup time and web server responsiveness in both the lab and the field. It helps identify when a web server is too slow to respond to requests. In the case of navigation requests, it precedes every other meaningful loading performance metric.
TTFB is a metric that measures the time between the request for a resource and when the first byte of the response begins to arrive. Since TTFB precedes user-centric metrics such as First Contentful Paint (FCP) and Largest Contentful Paint (LCP), it's recommended that your server responds to navigation requests quickly enough so that the 75th percentile of users experience an FCP within the "good" threshold. As a rough guide, most sites should strive to have a time to first byte of 0.8 seconds or less.
More about Time to First Byte can be found here.
Returns
getCLS
Cumulative Layout Shift (CLS) is an important, user-centric metric for measuring visual stability because it helps quantify how often users experience unexpected layout shifts—a low CLS helps ensure that the page is delightful.
CLS is a measure of the largest burst of layout shift scores for every unexpected layout shift that occurs during the entire lifespan of a page. A layout shift occurs any time a visible element changes its position from one rendered frame to the next.
More about Cumulative Layout Shift can be found here.
Returns
getFCP
First Contentful Paint (FCP) is an important, user-centric metric for measuring perceived load speed because it marks the first point in the page load timeline where the user can see anything on the screen—a fast FCP helps reassure the user that something is happening.
The FCP metric measures the time from when the page starts loading to when any part of the page's content is rendered on the screen. For this metric, "content" refers to text, images (including background images), <svg>
elements, or non-white <canvas>
elements. To provide a good user experience, sites should strive to have a First Contentful Paint of 1.8 seconds or less.
More about First Contentful Paint can be found here.
Returns
getFID
First Input Delay (FID) is an important, user-centric metric for measuring load responsiveness because it quantifies the experience users feel when trying to interact with unresponsive pages. A low FID helps ensure that the page is usable.
FID measures the time from when a user first interacts with a page (i.e. when they click a link, tap on a button, or use a custom, JavaScript-powered control) to the time when the browser can begin processing event handlers in response to that interaction. To provide a good user experience, sites should strive to have a First Input Delay of 100 milliseconds or less.
More about First Input Delay can be found here.
Returns
getLCP
Largest Contentful Paint (LCP) is an important, user-centric metric for measuring perceived load speed because it marks the point in the page load timeline when the page's main content has likely loaded—a fast LCP helps reassure the user that the page is useful.
The Largest Contentful Paint (LCP) metric reports the render time of the largest image or text block visible within the viewport, relative to when the page first started loading. To provide a good user experience, sites should strive to have a largest contentful Paint of 2.5 seconds or less.
More about Largest Contentful Paint can be found here.
Returns
getTBT
Total Blocking Time (TBT) is an important metric for measuring load responsiveness because it helps quantify the severity of how non-interactive a page is before it becomes reliably interactive. A low TBT helps ensure that the page is usable.
The TBT metric measures the total amount of time between First Contentful Paint (FCP) and Time to Interactive (TTI) where the main thread was blocked for long enough to prevent input responsiveness. To provide a good user experience, sites should strive to have a Total Blocking Time of less than 200 milliseconds when tested on average mobile hardware.
More about Total Blocking Time can be found here.
Returns
getTTI
Time to Interactive (TTI) is an important metric for measuring load responsiveness. It helps identify cases where a page looks interactive but is not. A fast TTI helps ensure that the page is usable.
The TTI metric measures the time from when the page starts loading to when its main sub-resources have loaded and it is capable of reliably responding to user input quickly. To provide a good user experience, sites should strive to have a Time to Interactive of less than 5 seconds when tested on average mobile hardware.
More about Time to Interactive can be found here.
Returns
getCPUIdle
Both First CPU Idle and Time to Interactive measure when the page is ready for user input. First CPU Idle occurs when the user can start to interact with the page; TTI occurs when the user is fully able to interact with the page.
First CPU Idle measures how long it takes a page to become minimally interactive. A page is considered minimally interactive when most (but not necessarily all) UI elements on the screen are interactive and the page responds, on average, to most user input in a reasonable amount of time. To provide a good user experience, sites should strive to have a First CPU Idle of 4.7 seconds or less.
More about First CPU Idle can be found here.
Returns
getLoadTime
Load time measures how long it takes a page to become "fully loaded". A page is considered fully loaded when the onload event is emitted. To provide a good user experience, sites should strive to have a load time of 3 seconds or less.
Returns
getInputDelay
Input delay measures the time from the initial page request to the time the main user interactions occur. These interactions include click
, scroll
, mousemove
, and keypress
. This metric is used to gain insight into how and when a user interacts with a given page. These values will be -1
if the event has not occurred at the time of measuring.
Returns
getNavigation
Navigation metrics measure the performance of all the processes that make up page navigation. In addition, it returns the size of the data transferred during the navigation. Optional properties are omitted if they are null.
Returns
0
: Navigate - A typical navigation.1
: Reload - A page reload.2
: Back/Forward - Back or forward navigation.3
: Prerender - A pre-render navigation.
getResources
Resource metrics measure the performance of all the processes that make up a resource request. Resources are the individual facets that make up a page (scripts, stylesheets, images, fonts, etc...). Optional properties, when null, will be xxx
for strings and -1
for numbers.
Returns
- If the initiator is a Element, the property returns the element's localName.
- If the initiator is a CSS resource, the property returns "css".
- If the initiator is a XMLHttpRequest object, the property returns "xmlhttprequest".
- If the initiator is a PerformanceNavigationTiming object, the property returns an empty string ("").