Yo.utils.console
Use these functions to display a variety of statistics and debugging information about the current page of your Yottaa site. The functions return diagnostic information including resources that Yottaa optimized, rules that Yottaa invoked, and data that Yottaa collected. These debugging functions make it possible to quickly and easily understand how Yottaa impacted a particular page.
Prerequisites
The following command to load the appropriate version of the Rapid+JS Library must precede the use of this function on the page. Specify your own site key:
<script src="https://rapid-cdn.yottaa.com/rapid/lib/sitekey.js"></script>
Syntax
Yo.utils.console.function()
Returns
Requested information, displayed on the developer tools console.
Parameters
Parameter |
Description |
---|---|
none | N/A |
Examples
See specific functions below.
Console Functions
Provides information about the Yo.utils.console functions.
Syntax
man()
Parameters
Parameter |
Description |
---|---|
none | N/A |
Example
Yo.utils.console.man(); \ \ / / | | | | \ V /___ | |_| |_ __ _ __ _ \ // _ \| __| __/ _` |/ _` | | | (_) | |_| || (_| | (_| | \_/\___/ \__|\__\__,_|\__,_| Use the console to see information about Yottaa running on your application. (index) command help 0 'Yo.utils.console.man();' 'You just ran this command, used for help' 1 'Yo.utils.console.rum();' 'See rum statistics captured by Yottaa for this web page.' 2 'Yo.utils.console.resources();' 'See information about resources that were loaded. add a URL to see details about that specific URL' 3 'Yo.utils.console.coreWebVitals();' 'See information about core web vitals as they happen on your website.' 4 'Yo.utils.console.sequencing();' 'See configuration for sequencing and resources its applied to' 5 'Yo.utils.console.storeLocalConfiguration();' 'Stores local configuration for easier debugging.' 6 'Yo.utils.console.updateABTest();' 'Updates an AB Test variation.' Array(7)
Displays RUM information captured by Yottaa for the current page, including page-level data, information about A/B tests, visitors, and navigation timing, and a brief summary of Core Web Vitals. To display more details about Core Web Vitals for the current page, see coreWebVitals, further below.
Running the rum() function in the console is very helpful for studying how the state changed on page transitions. On the site, click to a different page, then click back to the console and press ^ (up arrow) to rerun the rum() function. Now you can see which RUM values changed when the site displayed the now-current page. Note that when you transition from one page to another, in the Navigation Timing section rum() displays only the onLoad time, and displays zeroes for all the other timing values. This allows you to navigate around your site and see the onLoad performance of each individual page.
Information returned by this function includes:
Field | Description |
---|---|
Site Key | Your registered site key. |
Optimization State | "Active" means Yottaa is optimizing this page. Any other value indicates that the page is not optimized. |
Full URL | The current web page's full URL. |
Category | The page category that was assigned to the current page by using client side JavaScript. |
Title | The title you assigned to this page. |
User Agent | Characteristics of the user agent that presented the request resulting in the display of the current web page. |
Page Prefetched by Service Worker | Was the current page prefetched by a Yottaa service worker. Yes/No. |
Library Release Date | Date that the Yottaa library that you are running on your site was released. |
Is SPA Site | Is the current page a Single-Page Application site. Yes/No. |
Is Edge Page | Does the current page run Yottaa Edge Acceleration. Yes/No. |
SPA Trigger | If this page is a SPA site, the action that triggers the reload of a section of the page. |
Syntax
rum()
Parameters
Parameter |
Description |
---|---|
none | N/A |
Example
Displays information about resources that were loaded by the specified page. Add a URL or partial URL to see all the URLs that contain that string. This command is extremely useful for seeing what resources were loaded during page transitions. It presents all the loaded resources in an easy-to-read tabular format that includes resource name, resource type, resource load time, started loading time, and Yottaa sequencing type. All times are listed in milliseconds. The Started Loading value represents the time in milliseconds since the browser started to request the resources from the server, where 0 is the time that the browser requested the HTML or that a spa transition occurred.
Syntax
resources()
Parameters
Parameter |
Description |
---|---|
URL | Specify a complete or partial URL to display information about resources loaded by any page matching that URL string. |
Example
Displays current Core Web Vitals information for your website.
Syntax
coreWebVitals()
Parameters
Parameter |
Description |
---|---|
none | N/A |
Stores your local configuration to make debugging easier.
Syntax
storeLocationConfiguration()
Parameters
Parameter |
Description |
---|---|
none | N/A |
Example
> Yo.utils.console.storeLocationConfiguration();
Allows you to change the name for a specific A/B test variation. If the specified test is not found, the function does nothing.
The function stores the variant name in the browser's local store so that when the page is reloaded, Yottaa will apply this variant's configuration to the page.
Syntax
updateABTest([[testName],][variationName])
Parameters
Parameter |
Description |
---|---|
testName | Optional. The default is "A/B Testing". |
variationName |
Optional. Toggles from Optimized to Unoptimized. |