### Install and Serve Documentation Locally Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/README.md Install dependencies and start a local development server for the documentation. Requires Node.js 20 or newer. Run from the 'docs/' directory. ```bash npm install npm run serve ``` -------------------------------- ### Running Multiple Pre-Scripts in Order Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/scripting/pre-and-post-scripts/index.md This command-line example demonstrates how to run multiple pre-scripts in sequence before measuring URLs. This is useful for composing setup steps like consent, login, and geo-location overrides. ```bash sitespeed.io \ --preScript consent.mjs \ --preScript login.mjs \ --preScript geo.mjs \ https://example.org/page1 ``` -------------------------------- ### Run sitespeed.io after installation Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md After installing dependencies, switch to the 'sitespeedio' user and run sitespeed.io with specified options. This example tests the site 'https://www.sitespeed.io' using Chrome with video recording and visual metrics enabled. ```bash su - sitespeedio sitespeed.io https://www.sitespeed.io --xvfb -b chrome --video --visualMetrics ``` -------------------------------- ### Setup and Test on iOS with npm Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/_includes/index/install.md Install necessary tools and run sitespeed.io tests on Safari on iOS. This includes proxy setup and video recording. ```bash brew install ios-webkit-debug-proxy ``` ```bash brew install ffmpeg ``` ```bash sitespeed.io -b safari --safari.ios --video --visualMetrics https://www.sitespeed.io/ ``` -------------------------------- ### Example: Using WebPageTest plugin with Docker Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/plugins/index.md Demonstrates the full process of cloning, installing, and running the WebPageTest plugin with sitespeed.io via Docker. It includes steps for setting up the environment and executing the Docker command. ```bash cd mkdir test cd test git clone git@github.com:sitespeedio/plugin-webpagetest.git cd plugin-webpagetest npm install pwd /Users/peter/test/plugin-webpagetest docker run --rm -v /Users/peter/:/sitespeed.io sitespeedio/sitespeed.io --plugins.add /sitespeed.io/test/plugin-webpagetest/index.js https://www.sitespeed.io ``` -------------------------------- ### Install sitespeed.io with Docker Source: https://github.com/sitespeedio/sitespeed.io/blob/main/README.md Run sitespeed.io using the official Docker image. This is the easiest way to get started as the image includes all necessary dependencies. ```bash docker run --rm -v "$(pwd)":/sitespeed.io sitespeedio/sitespeed.io https://www.sitespeed.io/ ``` -------------------------------- ### Configure HTML Summary Boxes via Command Line Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/configure-html/index.md Use the --html.summaryBoxes argument to specify which metrics to display in the summary boxes on the start page. This example shows how to include page load time and total requests. ```bash docker run --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:{% include version/sitespeed.io.txt %} --html.summaryBoxes timings.pageLoadTime --html.summaryBoxes requests.total https://www.sitespeed.io ``` -------------------------------- ### Dockerfile for pre-baking plugins Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/plugins/index.md A Dockerfile example to create a custom sitespeed.io Docker image with plugins pre-installed. It clones a plugin repository, installs its dependencies, and sets it up for use. ```docker FROM sitespeedio/sitespeed.io: ENV SITESPEED_IO_PLUGINS__ADD /my-custom-plugin # You need to have git to clone your repo RUN sudo apt-get update && sudo apt-get install git -y WORKDIR /my-custom-plugin RUN git clone https://path.to/my-custom-plugin . RUN npm install --production VOLUME /sitespeed.io WORKDIR /sitespeed.io ``` -------------------------------- ### sitespeed.io Command Line Example Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/bug-report/index.md This is an example of a full sitespeed.io command line that you can use to reproduce a bug. Remember to redact any secrets before pasting. ```bash sitespeed.io ``` -------------------------------- ### Start Network Throttling in Node.js (Promise) Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/throttle/index.md Programmatically start network throttling in a Node.js application using the `start` export. This example uses Promises to handle the asynchronous operation. ```javascript import { start, stop } from '@sitespeed.io/throttle'; // Returns a promise start({ up: 360, down: 780, rtt: 200 }).then(() => ...); ``` -------------------------------- ### Start Docker containers Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/onlinetest/index.md Start all necessary Docker containers for dependencies, server, and test runner using docker compose. ```bash docker compose -f docker-compose.dependencies.yml -f docker-compose.server.yml -f docker-compose.testrunner.yml up ``` -------------------------------- ### Install and add a globally installed plugin Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/plugins/index.md Installs the Lighthouse plugin globally using npm and then adds it to sitespeed.io by its package name. This is for running sitespeed.io with Node.js. ```bash npm install @sitespeed.io/plugin-lighthouse -g sitespeed.io https://www.sitespeed.io --plugins.add @sitespeed.io/plugin-lighthouse ``` -------------------------------- ### Example Directory Structure for Continuous Testing Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/continuously-run-your-tests/index.md This tree displays the file and directory structure for a typical sitespeed.io continuous testing setup. It includes configuration files, shell scripts for execution, and test definition files. ```bash . ├── config │ ├── alexaDesktop.json │ ├── alexaMobile.json │ ├── crux.json │ ├── desktop.json │ ├── desktopMulti.json │ ├── emulatedMobile.json │ ├── emulatedMobileMulti.json │ ├── loginWikipedia.json │ ├── news.json │ ├── replay.json │ └── spa.json ├── loop.sh ├── run.sh └── tests ├── desktop │ ├── alexaDesktop.txt │ ├── crux.txt │ ├── desktop.txt │ ├── desktopMulti.js │ ├── loginWikipedia.js │ ├── news.txt │ ├── replay.replay │ └── spa.js └── emulatedMobile ├── alexaMobile.txt ├── emulatedMobile.txt └── emulatedMobileMulti.js ``` -------------------------------- ### Install Sitespeed.io Globally with npm Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/_includes/index/install.md Install sitespeed.io as a global npm package. Ensure you have the desired browser installed separately. ```bash npm install -g sitespeed.io ``` -------------------------------- ### Start Services on a Single Dedicated Server Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/onlinetest/index.md Starts the server, dependencies, and one testrunner using Docker Compose for a single-server deployment. ```bash sudo modprobe ifb numifbs=1 docker compose -f docker-compose.dependencies.yml -f docker-compose.server.yml -f docker-compose.testrunner.yml up -d ``` -------------------------------- ### Install PageXray CLI Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/pagexray/index.md Install the PageXray command-line interface globally using npm. ```bash npm install pagexray -g ``` -------------------------------- ### Clone and Install Coach Core Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/coach/developers/index.md Clone the coach-core repository, install its dependencies, and run tests. Requires Node.js 20+ and installed Chrome/Firefox for DOM tests. ```bash git clone git@github.com:/coach-core.git cd coach-core npm install npm test ``` -------------------------------- ### Run Project Locally Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/compare/index.md Start a local development server for the project. ```bash npm run develop ``` -------------------------------- ### Debug Graphite Metrics with TCP Server Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/graphite/index.md This example demonstrates how to test and verify the metrics sent to Graphite by using a local TCP server. It involves starting the server, running sitespeed.io with Graphite configured to point to the server's port, and then inspecting the output on the TCP server. ```bash tools/tcp-server.js ``` ```bash Server listening on :::60447 ``` ```bash docker run --shm-size=1g --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:{% include version/sitespeed.io.txt %} https://www.sitespeed.io/ --graphite.host 192.168.65.2 --graphite.port 60447 -n 1 --graphite.addSlugToKey true --slug firstView ``` ```plaintext sitespeed_io.default.firstView.pageSummary.www_sitespeed_io._.chrome.native.browsertime.statistics.timings.pageTimings.backEndTime.median 231 1532591185 sitespeed_io.default.firstView.pageSummary.www_sitespeed_io._.chrome.native.browsertime.statistics.timings.pageTimings.backEndTime.mean 231 1532591185 sitespeed_io.default.firstView.pageSummary.www_sitespeed_io._.chrome.native.browsertime.statistics.timings.pageTimings.backEndTime.mdev 0 1532591185 sitespeed_io.default.firstView.pageSummary.www_sitespeed_io._.chrome.native.browsertime.statistics.timings.pageTimings.backEndTime.min 231 1532591185 sitespeed_io.default.firstView.pageSummary.www_sitespeed_io._.chrome.native.browsertime.statistics.timings.pageTimings.backEndTime.p10 231 1532591185 sitespeed_io.default.firstView.pageSummary.www_sitespeed_io._.chrome.native.browsertime.statistics.timings.pageTimings.backEndTime.p90 231 1532591185 sitespeed_io.default.firstView.pageSummary.www_sitespeed_io._.chrome.native.browsertime.statistics.timings.pageTimings.backEndTime.p99 231 1532591185 sitespeed_io.default.firstView.pageSummary.www_sitespeed_io._.chrome.native.browsertime.statistics.timings.pageTimings.backEndTime.max 231 1532591185 ... ``` -------------------------------- ### Install Lighthouse Plugin for NodeJS Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/onlinetest/index.md If your test runner uses NodeJS, manually install the Lighthouse plugin globally using npm. ```bash npm install @sitespeed.io/plugin-lighthouse -g ``` -------------------------------- ### Navigate to a URL with additional setup Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/scripting/Commands.html This command navigates the browser to a specified URL. It also handles any necessary additional setup required for a page visit, ensuring a clean state. ```javascript await commands.navigate('https://www.example.org'); ``` -------------------------------- ### Define setUp and tearDown Functions Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/scripting/tips-and-tricks/index.md Implement script initialization and cleanup logic by defining separate setUp and tearDown functions. These functions receive the same context and commands as the main test function. ```javascript async function setUp(context, commands) { // do some useful set up }; async function perfTest(context, commands) { // add your own code here }; async function tearDown(context, commands) { // do some cleanup here }; module.exports = { setUp: setUp, tearDown: tearDown, test: perfTest }; ``` -------------------------------- ### Install sitespeed.io globally Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md Installs the sitespeed.io package globally using npm. Ensure npm is configured to install global packages without sudo. ```bash npm install sitespeed.io --location=global ``` -------------------------------- ### Execute Post-installation Script Source: https://github.com/sitespeedio/sitespeed.io/blob/main/AGENTS.md Runs a script automatically after installation; this script should not be bypassed. ```bash postinstall ``` -------------------------------- ### Install Throttle Globally Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/throttle/index.md Install the Throttle package globally using npm. This makes the command-line tool available on your system. ```bash npm install @sitespeed.io/throttle -g ``` -------------------------------- ### Install Firefox on Ubuntu Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md Installs the Firefox browser using apt. This is one of the supported browsers for running sitespeed.io tests. ```bash sudo apt install firefox -y ``` -------------------------------- ### Install coach-core library Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/coach/how-to/index.md Install the coach-core library using npm. This library is a pure ESM package and requires Node.js 20 or later. ```bash npm install coach-core ``` -------------------------------- ### Install Network Tools on Debian/Ubuntu Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/throttle/index.md On Debian/Ubuntu systems, install the `net-tools` and `iproute2` packages, which include the `ip` command required by Throttle for network manipulation. ```bash sudo apt-get install -y net-tools iproute2 ``` -------------------------------- ### Clone the WebPageReplay Repository Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/webpagereplay/index.md Clone the repository to get started with WebPageReplay. Ensure sitespeed.io is installed globally. ```bash git clone git@github.com:sitespeed/replay.git ``` -------------------------------- ### Install Python dependencies for Visual Metrics Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md Installs necessary Python packages for Visual Metrics using pip. Use `--break-system-packages` if pip refuses due to an externally managed environment. ```bash python3 -m pip install --user pillow pyssim opencv-python numpy scipy ``` -------------------------------- ### Build Documentation for Production Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/README.md Build the documentation site for production deployment. Output will be placed in the 'docs/_site/' directory. ```bash npm run build ``` -------------------------------- ### Install sitespeed.io dependencies on Ubuntu Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md Use this script to install all necessary dependencies for sitespeed.io on Ubuntu, including browsers and tools. It also creates a dedicated user for running sitespeed.io. ```bash bash <(curl -sL https://gist.githubusercontent.com/soulgalore/18fbf40670a343fa1cb0606756c90a00/raw/7218332445010ee64e3301f2021bcf18a91f0627/install-sitespeed.io-and-dependencies-ubuntu.sh) ``` -------------------------------- ### Manually start gnirehtet and throttle Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/mobile-phones/index.md Use these commands to manually start gnirehtet for multiple devices and then apply network throttling before running individual tests. This is recommended when running tests on multiple devices from the same host. ```bash gnirehtet autorun ``` ```bash throttle 4g ``` -------------------------------- ### Copy environment file Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/onlinetest/index.md Copy the example environment file to create your own configuration. ```bash cp .env.example .env ``` -------------------------------- ### Start sitespeed.io Server with Configuration File Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/onlinetest/index.md Run the sitespeed.io server using a specific configuration file. ```bash sitespeed.io-server --config path/to/file ``` -------------------------------- ### Running Pre and Post Scripts with sitespeed.io Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/scripting/pre-and-post-scripts/index.md This command-line example shows how to execute a pre-script for login and a post-script for logout when testing multiple URLs. ```bash sitespeed.io \ --preScript login.mjs \ --postScript logout.mjs \ https://example.org/page1 \ https://example.org/page2 ``` -------------------------------- ### Configure Grafana Environment Variables Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/performance-dashboard/index.md Example of environment variables within a Docker Compose file to install Grafana plugins. Ensure the plugin names are correct. ```yaml environment: - GF_INSTALL_PLUGINS=marcusolsson-json-datasource,marcusolsson-dynamictext-panel ... ``` -------------------------------- ### Get all configuration options Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/configuration/index.md Run this command to display all available configuration options for sitespeed.io. ```bash docker run --rm sitespeedio/sitespeed.io:{% include version/sitespeed.io.txt %} --help-all ``` -------------------------------- ### Enable XVFB for Virtual Frame Buffer Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/video/index.md Start XVFB automatically if running sitespeed.io without Docker and XVFB is installed. This provides a virtual frame buffer for graphical applications. ```bash --xvfb ``` -------------------------------- ### Derive Metric from Existing Metrics Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/scripting/custom-metrics/index.md Use this pattern to compute a derived value from collected metrics and attach it using `commands.measure.add`. This example calculates a rounded value of the Largest Contentful Paint start time. ```javascript /** * @param {import('browsertime').BrowsertimeContext} context * @param {import('browsertime').BrowsertimeCommands} commands */ export default async function (context, commands) { await commands.measure.start('https://www.example.org/'); await commands.measure.stop(); // Pull the metrics that just got collected, compute a derived value const metrics = await commands.js.run( ` const lcp = performance.getEntriesByType('largest-contentful-paint').slice(-1)[0]?.startTime; return { lcp: lcp ?? null }; `); if (metrics.lcp != null) { commands.measure.add('lcpRoundedToHundred', Math.round(metrics.lcp / 100) * 100); } }; ``` -------------------------------- ### Start sitespeed.io Server with Docker Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/onlinetest/index.md Run the sitespeed.io server using Docker, mounting a local configuration directory. ```bash docker run --rm -v "$(pwd)":/config sitespeedio/server:{% include version/onlinetest.txt %} --config /config/config.yml ``` -------------------------------- ### Browsertime CLI Help Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/browsertime/configuration/index.md Run this command to see all available configuration options for Browsertime in the CLI. ```shell browsertime --help ``` -------------------------------- ### Install Homebrew Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md Installs Homebrew, a package manager for macOS, which is a prerequisite for installing Node.js and other dependencies. ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` -------------------------------- ### Example Plugin Implementation Source: https://github.com/sitespeedio/sitespeed.io/blob/main/AGENTS.md Illustrates the minimum methods required for a plugin extending SitespeedioPlugin. This serves as a reference for custom plugin development. ```javascript class GrafanaPlugin extends SitespeedioPlugin { constructor(options, context, queue) { super(options, context, queue); } async open(context, options) { // ... } async processMessage(message, queue) { // Track message types, accumulate state, and emit new messages. if (message.type === 'url') { // ... } } } ``` -------------------------------- ### Run sitespeed.io with Budget Configuration Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/performance-budget/index.md Execute sitespeed.io with a specified budget configuration file. The exit status will be greater than 0 if the budget fails. ```bash docker run --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:{% include version/sitespeed.io.txt %} https://www.sitespeed.io/ --budget.configPath myBudget.json -b chrome -n 11 ``` -------------------------------- ### Install Node.js LTS on Raspberry Pi Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md Installs the latest LTS version of Node.js on your Raspberry Pi. Ensure you have curl installed. ```bash curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash - sudo apt install nodejs ``` -------------------------------- ### Install sitespeed.io with specific ChromeDriver version Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/_posts/2020-03-03-sitespeed.io-12.1-and-browsertime-8.1.md Install sitespeed.io and specify the ChromeDriver version to be installed using the CHROMEDRIVER_VERSION environment variable. ```bash CHROMEDRIVER_VERSION=81.0.4044.20 npm install ``` -------------------------------- ### Install Node.js LTS for sitespeed.io Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md Installs Node.js LTS version 24.x on Ubuntu systems. This is a prerequisite for installing sitespeed.io globally via npm. ```bash curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash - sudo apt install -y nodejs ``` -------------------------------- ### Extending Configuration Example Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/continuously-run-your-tests/index.md A basic JSON structure showing how to extend an existing configuration file. This is useful for modular configuration management. ```json { "extends": "/config/secrets.json", ... } ``` -------------------------------- ### Install Node.js LTS with Homebrew Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md Installs Node.js version 24 LTS using Homebrew. Ensure Node.js and npm are added to your PATH after installation. ```bash brew install node@24 ``` -------------------------------- ### Build Project Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/compare/index.md Build the project for deployment. This involves navigating to the project directory and running the build script. ```bash cd compare && npm run build ``` -------------------------------- ### Install Chrome-HAR Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/chrome-har/index.md Install the chrome-har package using npm. ```bash npm install chrome-har ``` -------------------------------- ### Start Network Throttling in Node.js (Async/Await) Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/throttle/index.md Programmatically start and stop network throttling in Node.js using `async/await` syntax. This provides a cleaner way to manage the asynchronous start and stop operations. ```javascript import { start, stop } from '@sitespeed.io/throttle'; const options = { up: 360, down: 780, rtt: 200 }; await start(options); // Do your thing and then stop await stop(); ``` -------------------------------- ### Push Example Data to Graphite Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/performance-dashboard/index.md Run a sitespeed.io test to push performance data to a Graphite host. Ensure Graphite is accessible at the specified host and port. ```bash sitespeed.io https://www.sitespeed.io -n 1 --slug myTest --graphite.host 127.0.0.1 ``` -------------------------------- ### Navigate to the project directory Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/onlinetest/index.md Change your current directory to the cloned onlinetest project. ```bash cd onlinetest ``` -------------------------------- ### PageXray Output Example Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/pagexray/index.md Example of the JSON output generated by PageXray, summarizing HAR file data. ```json [ { "url": "https://www.sitespeed.io/", "meta": { "browser": { "name": "Chrome", "version": "60.0.3112.78" }, "startedDateTime": "2017-08-24T18:26:29.077Z", "connectivity": "native", "title": "Sitespeed.io - Welcome to the wonderful world of Web Performance run 1" }, "finalUrl": "https://www.sitespeed.io/", "baseDomain": "www.sitespeed.io", "documentRedirects": 0, "redirectChain": [], "transferSize": 98791, "contentSize": 120776, "headerSize": 0, "requests": 10, "missingCompression": 0, "httpType": "h2", "httpVersion": "HTTP/2.0", "contentTypes": { "html": { "transferSize": 8479, "contentSize": 28279, "headerSize": 0, "requests": 1 }, "css": { "transferSize": 0, "contentSize": 0, "headerSize": 0, "requests": 0 }, "javascript": { "transferSize": 0, "contentSize": 0, "headerSize": 0, "requests": 0 }, "image": { "transferSize": 87309, "contentSize": 85979, "headerSize": 0, "requests": 8 }, "font": { "transferSize": 0, "contentSize": 0, "headerSize": 0, "requests": 0 }, "favicon": { "transferSize": 3003, "contentSize": 6518, "headerSize": 0, "requests": 1 } }, "assets": [], "responseCodes": { "200": 10 }, "firstParty": {}, "thirdParty": {}, "domains": { "www.sitespeed.io": { "transferSize": 98791, "contentSize": 120776, "headerSize": -10, "requests": 10, "timings": { "blocked": 169, "dns": 0, "connect": 0, "send": 6, "wait": 3624, "receive": 104 } } }, "expireStats": { "min": 600, "median": 31536000, "max": 31536000, "total": 283824600, "values": 10 }, "lastModifiedStats": { "min": 733347, "median": 733444, "max": 733480, "total": 7334359, "values": 10 }, "cookieStats": { "min": 0, "median": 0, "max": 0, "total": 0, "values": 10 }, "totalDomains": 1, "visualMetrics": { "FirstVisualChange": 617, "SpeedIndex": 625, "VisualComplete85": 617, "LastVisualChange": 1033, "VisualProgress": { "0": 0, "617": 98, "633": 98, "667": 98, "850": 98, "1033": 100 } } } ] ``` -------------------------------- ### Install ffmpeg for video recording Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md Installs the ffmpeg package, which is required for sitespeed.io's video recording functionality. ```bash sudo apt-get update -y && sudo apt-get install -y ffmpeg ``` -------------------------------- ### Example Performance Budget Configuration Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/continuous-integration/index.md Define rules for performance metrics like requests, transfer size, third parties, and scores to enforce performance best practices. This JSON file is used to break the build if performance targets are not met. ```json { "budget": { "requests": { "total": 100 }, "transferSize": { "total": 400000 }, "thirdParty": { "requests": 0 }, "score": { "bestpractice": 100, "privacy": 100, "performance": 100 } } } ``` -------------------------------- ### List All Available Metrics Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/configure-metrics/index.md Use the --metrics.list flag to generate a metrics.txt file containing all possible metrics that can be sent. ```bash docker run --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:{% include version/sitespeed.io.txt %} https://www.sitespeed.io --metrics.list ``` -------------------------------- ### Install ADB and Chromedriver on Raspberry Pi Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md Installs ADB and the Chromium-based Chromedriver necessary for browser automation on your Raspberry Pi. ```bash sudo apt-get update sudo apt-get install chromium-chromedriver adb -y ``` -------------------------------- ### Build and Run sitespeed.io with Docker Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/developers/index.md Build the sitespeed.io Docker image and run it, mounting the current directory to the container. The --shm-size flag is important for performance. ```bash docker build -t sitespeedio/sitespeed.io . ``` ```bash docker run --shm-size=1g --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io https://www.sitespeed.io/ ``` -------------------------------- ### Install ios-webkit-debug-proxy Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md Installs ios-webkit-debug-proxy using Homebrew, a tool used by Browsertime for HAR capture when testing on iOS devices. ```bash brew install ios-webkit-debug-proxy ``` -------------------------------- ### Install np for npm publish Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/developers/index.md Install np, a tool that improves the npm publish process. This is a prerequisite for releasing packages. ```bash npm install --global np ``` -------------------------------- ### Run sitespeed.io Locally Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/developers/index.md Execute sitespeed.io from the command line after installation. Use the verbose flag (-v) to increase log detail. ```bash bin/sitespeed.js https://www.sitespeed.io -n 1 ``` ```bash bin/sitespeed.js https://www.sitespeed.io -n 1 -v ``` -------------------------------- ### Build and run a custom Docker image with pre-baked plugins Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/plugins/index.md Builds a custom Docker image containing pre-baked plugins and then runs it. This avoids the need to mount plugin directories or install them separately during runtime. ```bash docker build -t my-custom-sitespeedio . docker run --rm -v "$(pwd):/sitespeed.io" my-custom-sitespeedio -b firefox --my-custom-plugin.option test -n 1 https://www.sitespeed.io/ ``` -------------------------------- ### Install Browsertime and Types Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/scripting/setting-up-intellisense/index.md Installs Browsertime and its associated types as a developer dependency using npm. This is a prerequisite for using Browsertime in your project. ```bash npm install browsertime --save-dev ``` -------------------------------- ### Add All Coach Advice Metrics Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/configure-metrics/index.md Configure sitespeed.io to send scores for all performance, best practice, and accessibility advice by specifying multiple filters on the command line. ```shell --metrics.filter coach.pageSummary.advice.performance.adviceList.*.score coach.pageSummary.advice.bestpractice.adviceList.*.score coach.pageSummary.advice.accessibility.adviceList.*.score ``` -------------------------------- ### Link Local Coach Core and Run sitespeed.io Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/coach/developers/index.md To test your local changes against a real page, link your modified `coach-core` package into your `sitespeed.io` checkout and then run `sitespeed.io` against a URL. This ensures the Coach uses your updated rules. ```bash # in coach-core npm link # in your sitespeed.io checkout npm link coach-core sitespeed.io https://www.sitespeed.io/ ``` -------------------------------- ### Install sitespeed.io dependencies on Debian Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md This command installs sitespeed.io dependencies on Debian systems. It downloads and executes a script that sets up the necessary environment. ```bash wget -O - https://gist.githubusercontent.com/soulgalore/2f070b0a150360053f7198a4e9067db1/raw/cc1c56577195832225ddc36460f6fc53510d6de3/install-sitespeed.io-and-dependencies-debian.sh | bash ``` -------------------------------- ### View all sitespeed.io configuration options Source: https://github.com/sitespeedio/sitespeed.io/blob/main/README.md Display all available command-line flags and options for sitespeed.io. Use this to explore advanced configuration. ```bash sitespeed.io --help ``` -------------------------------- ### Install Android platform tools Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/installation/index.md Installs ADB (Android Debug Bridge) using Homebrew, which is required for running tests on Android devices. ```bash brew install --cask android-platform-tools ``` -------------------------------- ### Use Pre-made Profile (Short Form) Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/throttle/index.md Apply the '3gslow' profile using the shorthand command. This is equivalent to using the `--profile` flag. ```bash throttle 3gslow ``` -------------------------------- ### Install Browsertime globally using yarn Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/browsertime/installation/index.md Install Browsertime globally on your system using yarn. This makes the 'browsertime' command available in your terminal. ```bash yarn global add browsertime ``` -------------------------------- ### Running sitespeed.io with a Configuration File Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/configuration/index.md Execute sitespeed.io using a Docker container, mounting the current directory and specifying a configuration file. Replace '{% include version/sitespeed.io.txt %}' with the actual version. ```bash docker run --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:{% include version/sitespeed.io.txt %} --config config.json https://www.sitespeed.io ``` -------------------------------- ### Running Pre-Script for Consent Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/sitespeed.io/scripting/cookies-and-consent/index.md Example command-line usage for sitespeed.io, demonstrating how to run a pre-script that sets consent cookies before measuring specified pages. ```bash sitespeed.io --preScript preScript-consent.mjs https://www.example.org/page1 https://www.example.org/page2 ``` -------------------------------- ### Install Browsertime globally using npm Source: https://github.com/sitespeedio/sitespeed.io/blob/main/docs/documentation/browsertime/installation/index.md Install Browsertime globally on your system using npm. This makes the 'browsertime' command available in your terminal. ```bash npm install browsertime -g ``` -------------------------------- ### Test a URL with sitespeed.io Source: https://github.com/sitespeedio/sitespeed.io/blob/main/README.md Basic command to test a URL using sitespeed.io after installing it via npm. Requires a browser installed locally. ```bash sitespeed.io https://example.com ```