Skip to content

Conversation

@tunetheweb
Copy link
Member

Resolves #111

Fetches HTTP header Speculation Rules and stores them in the performance custom metric.

Test websites:

@tunetheweb tunetheweb requested a review from pmeenan June 29, 2025 19:23
Copy link
Member

@pmeenan pmeenan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM though wondering if it might be possible to pull the speculation rules fetch itself out of the $WPT_REQUESTS data.

Copy link
Member

@pmeenan pmeenan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. If the Sec-FetchDest` request header is available, it might be more accurate to use that but I'm not sure if the header is available at custom-metrics time.

@github-actions
Copy link

github-actions bot commented Jul 2, 2025

https://almanac.httparchive.org/en/2022/

WPT result details

Changed custom metrics values:

{
  "_performance": {
    "lcp_elem_stats": {
      "startTime": 472,
      "nodeName": "IMG",
      "url": "https://almanac.httparchive.org/static/images/home-hero.png",
      "size": 161505,
      "loadTime": 342.40000000596046,
      "renderTime": 472,
      "attributes": [
        {
          "name": "src",
          "value": "/static/images/home-hero.png"
        },
        {
          "name": "alt",
          "value": ""
        },
        {
          "name": "width",
          "value": "820"
        },
        {
          "name": "height",
          "value": "562"
        },
        {
          "name": "fetchpriority",
          "value": "high"
        }
      ],
      "boundingClientRect": {
        "x": 866,
        "y": 339.109375,
        "width": 485,
        "height": 332.390625,
        "top": 339.109375,
        "right": 1351,
        "bottom": 671.5,
        "left": 866
      },
      "naturalWidth": 820,
      "naturalHeight": 562,
      "styles": {
        "background-image": "none",
        "pointer-events": "auto",
        "position": "relative",
        "width": "485px",
        "height": "332.391px"
      },
      "percentOfViewport": "0.173",
      "cover90viewport": false
    },
    "raw_lcp_element": {
      "nodeName": "IMG",
      "attributes": [
        {
          "name": "src",
          "value": "/static/images/home-hero.png"
        },
        {
          "name": "alt",
          "value": ""
        },
        {
          "name": "width",
          "value": "820"
        },
        {
          "name": "height",
          "value": "562"
        },
        {
          "name": "fetchpriority",
          "value": "high"
        }
      ]
    },
    "lcp_resource": {
      "id": "34933.10",
      "sequence": 10,
      "body": "/home/pmeenan/wptagent/work/wptagent-v6-manual-20241002-10.20.0.3/250702_5D_15.1.0/bodies/34933.10",
      "url": "https://almanac.httparchive.org/static/images/home-hero.png",
      "status": 200,
      "connectionId": 125,
      "protocol": "h2",
      "connectionReused": true,
      "fromServiceWorker": false,
      "timing": {
        "requestTime": 75948.01666,
        "proxyStart": -1,
        "proxyEnd": -1,
        "dnsStart": -1,
        "dnsEnd": -1,
        "connectStart": -1,
        "connectEnd": -1,
        "sslStart": -1,
        "sslEnd": -1,
        "workerStart": -1,
        "workerReady": -1,
        "workerFetchStart": -1,
        "workerRespondWithSettled": -1,
        "sendStart": 6.032,
        "sendEnd": 6.802,
        "pushStart": 0,
        "pushEnd": 0,
        "receiveHeadersStart": 57.775,
        "receiveHeadersEnd": 58.598
      },
      "fromDiskCache": false,
      "remoteIPAddress": "[2607:f8b0:4004:c07::79]",
      "remotePort": 443,
      "securityState": "secure",
      "securityDetails": {
        "protocol": "TLS 1.3",
        "keyExchange": "",
        "keyExchangeGroup": "X25519",
        "cipher": "AES_128_GCM",
        "certificateId": 0,
        "subjectName": "almanac.httparchive.org",
        "sanList": [
          "almanac.httparchive.org"
        ],
        "issuer": "WR3",
        "validFrom": 1747802989,
        "validTo": 1755582041,
        "signedCertificateTimestampList": [
          {
            "status": "Verified",
            "origin": "Embedded in certificate",
            "logDescription": "Let's Encrypt 'Oak2025h2'",
            "logId": "0DE1F2302BD30DC140621209EA552EFC47747CB1D7E930EF0E421EB47E4EAA34",
            "timestamp": 1747806589725,
            "hashAlgorithm": "SHA-256",
            "signatureAlgorithm": "ECDSA",
            "signatureData": "3046022100F01F1EEC48A8367228365F844D9F436AD4DFCAD4DC3FDC6B90B00C7DD4A7F643022100CD560F6DAE12D3EC7E93275CE003A21CAB46C8CB876AF4BF58B3BDCBBC8C8F9C"
          },
          {
            "status": "Verified",
            "origin": "Embedded in certificate",
            "logDescription": "Google 'Xenon2025h2' log",
            "logId": "DDDCCA3495D7E11605E79532FAC79FF83D1C50DFDB003A1412760A2CACBBC82A",
            "timestamp": 1747806589823,
            "hashAlgorithm": "SHA-256",
            "signatureAlgorithm": "ECDSA",
            "signatureData": "304502200BF49F0A1D1AAAC58AAAF49F63516A4AFA6C54FBC0966BA7484D62865680B3E20221008D8FABB31E8E2A36B30ECE8F9A6E183274DFCBC628DF5D2D5935125BF5381026"
          }
        ],
        "certificateTransparencyCompliance": "compliant",
        "serverSignatureAlgorithm": 2052,
        "encryptedClientHello": false
      },
      "fromPrefetchCache": false,
      "response_headers": {
        "cache-control": "public, max-age=10800",
        "content-type": "image/png",
        "date": "Wed, 02 Jul 2025 18:20:36 GMT",
        "etag": "\"EQi8WA\"",
        "expires": "Wed, 02 Jul 2025 21:20:36 GMT",
        "server": "Google Frontend",
        "strict-transport-security": "max-age=31556926; includeSubDomains",
        "vary": "Accept-Encoding",
        "x-cloud-trace-context": "cc84f2923775dde6df036b3000f85c5c",
        "x-content-type-options": "nosniff"
      },
      "request_headers": {
        ":authority": "almanac.httparchive.org",
        ":method": "GET",
        ":path": "/static/images/home-hero.png",
        ":scheme": "https",
        "accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
        "accept-encoding": "gzip, deflate, br, zstd",
        "accept-language": "en-US,en;q=0.9",
        "priority": "u=1, i",
        "referer": "https://almanac.httparchive.org/en/2022/",
        "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"138\", \"Google Chrome\";v=\"138\"",
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "\"Unknown\"",
        "sec-fetch-dest": "image",
        "sec-fetch-mode": "no-cors",
        "sec-fetch-site": "same-origin",
        "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 PTST/250702.151337"
      },
      "initiator": {
        "type": "parser",
        "url": "https://almanac.httparchive.org/en/2022/",
        "lineNumber": 1425,
        "columnNumber": 99
      },
      "documentURL": "https://almanac.httparchive.org/en/2022/",
      "timestamp": 75947.996856,
      "frameId": "90D34EF390B181194D6CE71855E0618F",
      "hasUserGesture": false,
      "type": "Image",
      "wallTime": 1751480436.809635,
      "initialPriority": "High",
      "priority": "High",
      "transfer_size": 38208
    },
    "is_lcp_statically_discoverable": true,
    "is_lcp_preloaded": false,
    "lcp_preload": [],
    "web_vitals_js": [
      "https://almanac.httparchive.org/static/js/web-vitals.js?v=8d892f61f132b9a5889c5811203fa593"
    ],
    "gaming_metrics": [],
    "speculation_rules": {
      "htmlRules": [
        {
          "prerender": [
            {
              "source": "document",
              "where": {
                "and": [
                  {
                    "href_matches": "/*"
                  },
                  {
                    "not": {
                      "href_matches": "/static/*"
                    }
                  }
                ]
              },
              "eagerness": "moderate"
            }
          ]
        }
      ],
      "httpHeaderRules": []
    }
  }
}
https://example.com

WPT result details

Changed custom metrics values:

{
  "_performance": {
    "lcp_elem_stats": {
      "startTime": 408,
      "nodeName": "P",
      "url": "",
      "size": 33858,
      "loadTime": 0,
      "renderTime": 408,
      "attributes": [],
      "boundingClientRect": {
        "x": 383,
        "y": 192.875,
        "width": 600,
        "height": 57,
        "top": 192.875,
        "right": 983,
        "bottom": 249.875,
        "left": 383
      },
      "styles": {
        "background-image": "none",
        "pointer-events": "auto",
        "position": "static",
        "width": "600px",
        "height": "57px"
      },
      "percentOfViewport": "0.0368",
      "cover90viewport": false
    },
    "raw_lcp_element": null,
    "lcp_resource": null,
    "is_lcp_statically_discoverable": true,
    "is_lcp_preloaded": null,
    "lcp_preload": null,
    "web_vitals_js": [],
    "gaming_metrics": [],
    "speculation_rules": {
      "htmlRules": [],
      "httpHeaderRules": []
    }
  }
}
https://blkandbold.com

WPT result details

Changed custom metrics values:

{
  "_performance": {
    "lcp_elem_stats": {
      "startTime": 2024,
      "nodeName": "IMG",
      "url": "https://blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=832",
      "size": 461227,
      "loadTime": 1944.2999999970198,
      "renderTime": 2024,
      "attributes": [
        {
          "name": "src",
          "value": "//blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=4000"
        },
        {
          "name": "alt",
          "value": ""
        },
        {
          "name": "srcset",
          "value": "//blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=352 352w, //blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=832 832w, //blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=1200 1200w, //blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=1920 1920w, //blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=4000 4000w"
        },
        {
          "name": "width",
          "value": "4000"
        },
        {
          "name": "height",
          "value": "4000.0"
        },
        {
          "name": "loading",
          "value": "eager"
        },
        {
          "name": "class",
          "value": "hero__image hero__image--slide_FrcefU image-element"
        },
        {
          "name": "sizes",
          "value": "\n\n(min-width: 769px) 60vw, 100vw"
        },
        {
          "name": "data-animate",
          "value": "fadein"
        }
      ],
      "boundingClientRect": {
        "x": 540.390625,
        "y": 112,
        "width": 810.59375,
        "height": 700,
        "top": 112,
        "right": 1350.984375,
        "bottom": 812,
        "left": 540.390625
      },
      "naturalWidth": 819,
      "naturalHeight": 819,
      "styles": {
        "background-image": "none",
        "pointer-events": "auto",
        "position": "relative",
        "width": "810.594px",
        "height": "700px"
      },
      "percentOfViewport": "0.496",
      "cover90viewport": false
    },
    "raw_lcp_element": {
      "nodeName": "IMG",
      "attributes": [
        {
          "name": "src",
          "value": "//blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=4000"
        },
        {
          "name": "alt",
          "value": ""
        },
        {
          "name": "srcset",
          "value": "//blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=352 352w, //blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=832 832w, //blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=1200 1200w, //blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=1920 1920w, //blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=4000 4000w"
        },
        {
          "name": "width",
          "value": "4000"
        },
        {
          "name": "height",
          "value": "4000.0"
        },
        {
          "name": "loading",
          "value": "eager"
        },
        {
          "name": "class",
          "value": "hero__image hero__image--slide_FrcefU\n image-element"
        },
        {
          "name": "sizes",
          "value": "\n\n(min-width: 769px) 60vw, 100vw"
        },
        {
          "name": "data-animate",
          "value": "fadein"
        }
      ]
    },
    "lcp_resource": {
      "id": "36267.23",
      "sequence": 19,
      "body": "/home/pmeenan/wptagent/work/wptagent-v6-manual-20241002-10.20.0.3/250702_B8_17.1.0/bodies/36267.23",
      "url": "https://blkandbold.com/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=832",
      "status": 200,
      "connectionId": 131,
      "protocol": "h2",
      "connectionReused": true,
      "fromServiceWorker": false,
      "timing": {
        "requestTime": 76018.303185,
        "proxyStart": -1,
        "proxyEnd": -1,
        "dnsStart": -1,
        "dnsEnd": -1,
        "connectStart": -1,
        "connectEnd": -1,
        "sslStart": -1,
        "sslEnd": -1,
        "workerStart": -1,
        "workerReady": -1,
        "workerFetchStart": -1,
        "workerRespondWithSettled": -1,
        "sendStart": 0.672,
        "sendEnd": 1.987,
        "pushStart": 0,
        "pushEnd": 0,
        "receiveHeadersStart": 82.053,
        "receiveHeadersEnd": 82.445
      },
      "fromDiskCache": false,
      "remoteIPAddress": "23.227.38.32",
      "remotePort": 443,
      "securityState": "secure",
      "securityDetails": {
        "protocol": "TLS 1.3",
        "keyExchange": "",
        "keyExchangeGroup": "X25519MLKEM768",
        "cipher": "AES_128_GCM",
        "certificateId": 0,
        "subjectName": "blkandbold.com",
        "sanList": [
          "blkandbold.com"
        ],
        "issuer": "WE1",
        "validFrom": 1748300790,
        "validTo": 1756080379,
        "signedCertificateTimestampList": [
          {
            "status": "Verified",
            "origin": "Embedded in certificate",
            "logDescription": "Cloudflare 'Nimbus2025'",
            "logId": "CCFB0F6A85710965FE959B53CEE9B27C22E9855C0D978DB6A97E54C0FE4C0DB0",
            "timestamp": 1748304391594,
            "hashAlgorithm": "SHA-256",
            "signatureAlgorithm": "ECDSA",
            "signatureData": "30450220107F46F630D718891071676D1883A4A797E3A726852518705CB4579BC60335DE022100D5463D701E7E33403CDBB0192F9B428F4131667E0498D61F9DFF0BE0FECEEAE1"
          },
          {
            "status": "Verified",
            "origin": "Embedded in certificate",
            "logDescription": "Google 'Argon2025h2' log",
            "logId": "12F14E34BD53724C840619C38F3F7A13F8E7B56287889C6D300584EBE586263A",
            "timestamp": 1748304391532,
            "hashAlgorithm": "SHA-256",
            "signatureAlgorithm": "ECDSA",
            "signatureData": "3045022100CB3DB6545683B6D88DE4550EADF6B6624B0D3EE2A08A944BE003C1C73918FC290220509621BD4D563A5D74ABB410ED7435466D7C43C7823743764ABA6F7858B8933C"
          }
        ],
        "certificateTransparencyCompliance": "compliant",
        "serverSignatureAlgorithm": 1027,
        "encryptedClientHello": false
      },
      "fromPrefetchCache": false,
      "response_headers": {
        "accept-ranges": "bytes",
        "access-control-allow-origin": "*",
        "access-control-expose-headers": "*",
        "age": "4689037",
        "alt-svc": "h3=\":443\"; ma=86400",
        "cache-control": "public, max-age=31557600",
        "cf-cache-status": "HIT",
        "cf-ray": "95902a319e783ec9-IAD",
        "content-length": "42270",
        "content-security-policy": "sandbox allow-scripts allow-forms allow-modals allow-popups allow-downloads allow-top-navigation-by-user-activation",
        "content-type": "image/webp",
        "date": "Wed, 02 Jul 2025 18:21:47 GMT",
        "last-modified": "Thu, 21 Nov 2024 11:46:29 GMT",
        "nel": "{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}",
        "report-to": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=YH9jd6%2BP1qQePE4ggStvb8HlCNuR5pUIQIiZ%2BkmJsELqaYiZvpjxeiMWqVYRFD5mcAGV%2B6iTqd5j%2FDtON1K43Q5qyV8jz50rVxMQP8ysAqg12FLrNTEKQUCO0AGd8IN7\"}],\"group\":\"cf-nel\",\"max_age\":604800}",
        "server": "cloudflare",
        "server-timing": "imagery;dur=205.818, imageryFetch;dur=48.326, imageryProcess;dur=157.017;desc=\"image\"\ncfRequestDuration;dur=30.999899",
        "shopify-edge-ip": "23.227.38.32",
        "source-length": "249183",
        "source-type": "image/jpeg",
        "strict-transport-security": "max-age=63072000; includeSubDomains; preload",
        "timing-allow-origin": "*",
        "vary": "Accept, Accept-Encoding",
        "x-content-type-options": "nosniff",
        "x-dc": "gcp-us-east1,gcp-us-central1",
        "x-download-options": "noopen",
        "x-permitted-cross-domain-policies": "none",
        "x-request-id": "4ad272ea-ea07-470e-aa0a-568cb4fa040d-1732189589",
        "x-shopid": "2322235445",
        "x-sorting-hat-podid": "197",
        "x-sorting-hat-shopid": "2322235445",
        "x-xss-protection": "1; mode=block"
      },
      "request_headers": {
        ":authority": "blkandbold.com",
        ":method": "GET",
        ":path": "/cdn/shop/files/web_BLK-_-Bold-Specialty-Coffee-_-Beverages_r1_bag-o-beans_82680.jpg?v=1724690124&width=832",
        ":scheme": "https",
        "accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
        "accept-encoding": "gzip, deflate, br, zstd",
        "accept-language": "en-US,en;q=0.9",
        "cookie": "keep_alive=e5262082-cc95-4445-b184-a58325f52b4b; localization=US; cart_currency=USD; _shopify_y=3e544e3d-fe03-4090-a682-e8414233398d; _shopify_s=4afa0443-6113-4754-a60a-84272baa11f3; _tracking_consent=3.AMPS_USDC_f_f_yRLHTtLZRK23f9ulXpcRfA; _orig_referrer=; _landing_page=%2F",
        "priority": "u=2, i",
        "referer": "https://blkandbold.com/",
        "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"138\", \"Google Chrome\";v=\"138\"",
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "\"Unknown\"",
        "sec-fetch-dest": "image",
        "sec-fetch-mode": "no-cors",
        "sec-fetch-site": "same-origin",
        "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 PTST/250702.151337"
      },
      "initiator": {
        "type": "parser",
        "url": "https://blkandbold.com/",
        "lineNumber": 3645,
        "columnNumber": 54
      },
      "documentURL": "https://blkandbold.com/",
      "timestamp": 76018.301982,
      "frameId": "B5913EEAED4E1D7C3235C4E788B13D65",
      "hasUserGesture": false,
      "type": "Image",
      "wallTime": 1751480507.114786,
      "initialPriority": "Medium",
      "priority": "Medium",
      "transfer_size": 42825
    },
    "is_lcp_statically_discoverable": true,
    "is_lcp_preloaded": false,
    "lcp_preload": [],
    "web_vitals_js": [
      "https://blkandbold.com/cdn/shopifycloud/perf-kit/shopify-perf-kit-1.6.6.min.js",
      "https://cdn.shopify.com/shopifycloud/checkout-web/assets/c1.en/app.rndyD_a3.js"
    ],
    "gaming_metrics": {
      "fidIframeOverlaySoft": true
    },
    "speculation_rules": {
      "htmlRules": [],
      "httpHeaderRules": [
        {
          "url": "https://blkandbold.com/cdn/shopifycloud/shopify/assets/storefront/storefronts.specrules-828df0376f942523726504d6cb4fbacd41a1db514689a84555c7d42872ee5363.json",
          "rule": {
            "tag": "shopify_storefront",
            "prefetch": [
              {
                "where": {
                  "or": [
                    {
                      "href_matches": "/(products|collections|pages|search|shop|blogs|policies){/*}?"
                    },
                    {
                      "href_matches": "/([a-z]{2,3}|zh-hans|zh-hant)(-[a-z]{2,3})?/(products|collections|pages|search|shop|blogs|policies){/*}?"
                    },
                    {
                      "href_matches": "/"
                    },
                    {
                      "href_matches": "/([a-z]{2,3}|zh-hans|zh-hant)(-[a-z]{2,3})?{/}?"
                    }
                  ]
                },
                "eagerness": "conservative"
              }
            ]
          }
        }
      ]
    }
  }
}
https://www.hillhousehome.com

WPT result details

Changed custom metrics values:

{
  "_performance": {
    "lcp_elem_stats": {
      "startTime": 6428,
      "nodeName": "IMG",
      "url": "https://www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_1440x720.png?v=1751373140",
      "size": 433671,
      "loadTime": 6227.9000000059605,
      "renderTime": 6428,
      "attributes": [
        {
          "name": "class",
          "value": "inlineImg desktop lazyautosizes lazyloaded"
        },
        {
          "name": "src",
          "value": "//www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_32x16.png?v=1751373140"
        },
        {
          "name": "style",
          "value": "\n      --focal-x: 50.0%;\n      --focal-y: 50.0%;\n      \n    "
        },
        {
          "name": "data-widths",
          "value": "[540, 720, 900, 1080, 1250, 1440, 1680, 1920]"
        },
        {
          "name": "data-aspectratio",
          "value": "2.0"
        },
        {
          "name": "data-sizes",
          "value": "auto"
        },
        {
          "name": "alt",
          "value": ""
        },
        {
          "name": "data-srcset",
          "value": "//www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_540x270.png?v=1751373140 540w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_720x360.png?v=1751373140 720w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_900x450.png?v=1751373140 900w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_1080x540.png?v=1751373140 1080w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_1250x625.png?v=1751373140 1250w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_1440x720.png?v=1751373140 1440w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_1680x840.png?v=1751373140 1680w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_1920x960.png?v=1751373140 1920w"
        },
        {
          "name": "sizes",
          "value": "1351px"
        },
        {
          "name": "srcset",
          "value": "//www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_540x270.png?v=1751373140 540w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_720x360.png?v=1751373140 720w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_900x450.png?v=1751373140 900w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_1080x540.png?v=1751373140 1080w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_1250x625.png?v=1751373140 1250w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_1440x720.png?v=1751373140 1440w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_1680x840.png?v=1751373140 1680w, //www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_1920x960.png?v=1751373140 1920w"
        }
      ],
      "boundingClientRect": {
        "x": 0,
        "y": 401,
        "width": 1351,
        "height": 584,
        "top": 401,
        "right": 1351,
        "bottom": 985,
        "left": 0
      },
      "naturalWidth": 1351,
      "naturalHeight": 675,
      "styles": {
        "background-image": "none",
        "pointer-events": "auto",
        "position": "absolute",
        "width": "1351px",
        "height": "584px"
      },
      "percentOfViewport": "0.407",
      "cover90viewport": false
    },
    "raw_lcp_element": null,
    "lcp_resource": {
      "id": "37386.352",
      "sequence": 241,
      "body": "/home/pmeenan/wptagent/work/wptagent-v6-manual-20241002-10.20.0.3/250702_HH_18.1.0/bodies/37386.352",
      "url": "https://www.hillhousehome.com/cdn/shop/files/desktop-event-homepagehero-sweetpeas_1440x720.png?v=1751373140",
      "status": 200,
      "connectionId": 167,
      "protocol": "h3",
      "connectionReused": true,
      "fromServiceWorker": false,
      "timing": {
        "requestTime": 76142.540794,
        "proxyStart": -1,
        "proxyEnd": -1,
        "dnsStart": -1,
        "dnsEnd": -1,
        "connectStart": -1,
        "connectEnd": -1,
        "sslStart": -1,
        "sslEnd": -1,
        "workerStart": -1,
        "workerReady": -1,
        "workerFetchStart": -1,
        "workerRespondWithSettled": -1,
        "sendStart": 5.074,
        "sendEnd": 5.639,
        "pushStart": 0,
        "pushEnd": 0,
        "receiveHeadersStart": 102.891,
        "receiveHeadersEnd": 104.058
      },
      "fromDiskCache": false,
      "remoteIPAddress": "[2620:127:f00f:e::]",
      "remotePort": 443,
      "securityState": "secure",
      "securityDetails": {
        "protocol": "QUIC",
        "keyExchange": "",
        "keyExchangeGroup": "X25519MLKEM768",
        "cipher": "AES_128_GCM",
        "certificateId": 0,
        "subjectName": "www.hillhousehome.com",
        "sanList": [
          "www.hillhousehome.com"
        ],
        "issuer": "WE1",
        "validFrom": 1748228651,
        "validTo": 1756008247,
        "signedCertificateTimestampList": [
          {
            "status": "Verified",
            "origin": "Embedded in certificate",
            "logDescription": "Cloudflare 'Nimbus2025'",
            "logId": "CCFB0F6A85710965FE959B53CEE9B27C22E9855C0D978DB6A97E54C0FE4C0DB0",
            "timestamp": 1748232252420,
            "hashAlgorithm": "SHA-256",
            "signatureAlgorithm": "ECDSA",
            "signatureData": "3046022100DD062D1F8AD6CF3F16F79050CF5AB096A22C29089B53177CA73DF351DE70D0CC022100BBB406EAB46C35C3B76698EBCA2EDC94CED8FD62F776930575C1F8E322BAD666"
          },
          {
            "status": "Verified",
            "origin": "Embedded in certificate",
            "logDescription": "Google 'Xenon2025h2' log",
            "logId": "DDDCCA3495D7E11605E79532FAC79FF83D1C50DFDB003A1412760A2CACBBC82A",
            "timestamp": 1748232252382,
            "hashAlgorithm": "SHA-256",
            "signatureAlgorithm": "ECDSA",
            "signatureData": "304402203FE476A19D539722231D1467379375E298BD22485D87A10790B7D210BE61F75A022051C72028904FAC252AF4F5C0FC41B522886464591FFBFFC644FE712158251057"
          }
        ],
        "certificateTransparencyCompliance": "compliant",
        "serverSignatureAlgorithm": 1027,
        "encryptedClientHello": false
      },
      "fromPrefetchCache": false,
      "response_headers": {
        "accept-ranges": "bytes",
        "access-control-allow-origin": "*",
        "access-control-expose-headers": "*",
        "age": "99494",
        "alt-svc": "h3=\":443\"; ma=86400",
        "cache-control": "public, max-age=31557600",
        "cf-cache-status": "HIT",
        "cf-ray": "95902d3a7ec4e642-IAD",
        "content-length": "137214",
        "content-security-policy": "sandbox allow-scripts allow-forms allow-modals allow-popups allow-downloads allow-top-navigation-by-user-activation",
        "content-type": "image/webp",
        "date": "Wed, 02 Jul 2025 18:23:51 GMT",
        "last-modified": "Tue, 01 Jul 2025 13:14:35 GMT",
        "nel": "{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}",
        "priority": "u=3,i",
        "report-to": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=ozJx%2FREpGdM5rVg2QRUWGDAYz%2BosRKDDt0iFj8b11RdXgaOFQgR6hRWQTNHl1Bnp090%2FHmJzYFfBwnO6v0wfN%2B4IBJLRQbpl98fq7NhlenNIhQVWRNQm7gW2Es9n4pEa%2FHtZnzxtaVcnVEJQ1NzxuiALEw%3D%3D\"}],\"group\":\"cf-nel\",\"max_age\":604800}",
        "server": "cloudflare",
        "server-timing": "imagery;dur=1049.356, imageryFetch;dur=238.539, imageryProcess;dur=809.668;desc=\"image\"\ncfRequestDuration;dur=18.000126\nipv6\ncfExtPri",
        "shopify-edge-ip": "2620:127:f00f:e::",
        "source-length": "14845627",
        "source-type": "image/png",
        "strict-transport-security": "max-age=63072000; includeSubDomains; preload",
        "timing-allow-origin": "*",
        "vary": "Accept, Accept-Encoding",
        "x-content-type-options": "nosniff",
        "x-dc": "gcp-us-central1,gcp-us-central1",
        "x-download-options": "noopen",
        "x-permitted-cross-domain-policies": "none",
        "x-request-id": "9b3d5cdc-766e-4ba2-8021-4dcb05a6eeff-1751375674",
        "x-shopid": "9321794",
        "x-sorting-hat-podid": "42",
        "x-sorting-hat-shopid": "9321794",
        "x-xss-protection": "1; mode=block"
      },
      "request_headers": {
        ":authority": "www.hillhousehome.com",
        ":method": "GET",
        ":path": "/cdn/shop/files/desktop-event-homepagehero-sweetpeas_1440x720.png?v=1751373140",
        ":scheme": "https",
        "accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
        "accept-encoding": "gzip, deflate, br, zstd",
        "accept-language": "en-US,en;q=0.9",
        "cookie": "localization=US; cart_currency=USD; _shopify_y=ca76bddd-0760-4d6f-a680-5ca6fc96814b; _orig_referrer=; _landing_page=%2F; _vwo_uuid_v2=DAF660A439A7DCB8064857D1CE3558C48|6a272d532a3ad150cb18f39c20ae40ea; _dyjsession=jw2yzgdfwxv68o4v0kaszjthcw6rey86; dy_fs_page=www.hillhousehome.com; _vwo_uuid=DAF660A439A7DCB8064857D1CE3558C48; _vwo_sn=0%3A1; _vis_opt_s=1%7C; _vis_opt_test_cookie=1; _dyid=-3652419051232855757; _dy_geo=US.NA.US_DC.US_DC_Washington; _dy_df_geo=United%20States.District%20Of%20Columbia.Washington; _dy_toffset=0; _dy_soct=1751480627!2615182.0'2922738.0'3070477.0!; Intent_Audience=Low; _heatVid_3390=5702182348431001006; _heatIdvUpdated_3390=1751480628431; __kla_id=eyJjaWQiOiJObUU0WkdRME16VXROREpqWVMwME9UZzNMVGxrTURZdFpqZ3pNREl4WmpVeVpqbGoiLCIkcmVmZXJyZXIiOnsidHMiOjE3NTE0ODA2MjksInZhbHVlIjoiIiwiZmlyc3RfcGFnZSI6Imh0dHBzOi8vd3d3LmhpbGxob3VzZWhvbWUuY29tLyJ9LCIkbGFzdF9yZWZlcnJlciI6eyJ0cyI6MTc1MTQ4MDYyOSwidmFsdWUiOiIiLCJmaXJzdF9wYWdlIjoiaHR0cHM6Ly93d3cuaGlsbGhvdXNlaG9tZS5jb20vIn19; keep_alive=eyJ2IjoyLCJ0cyI6MTc1MTQ4MDYyODYzNSwiZW52Ijp7IndkIjowLCJ1YSI6MSwiY3YiOjEsImJyIjoxfSwiYmh2Ijp7Im1hIjowLCJjYSI6MCwia2EiOjAsInNhIjowLCJ0YSI6MCwia2JhIjowLCJ0IjowLCJubSI6MCwibXMiOjAsIm1qIjowLCJtc3AiOjAsInZjIjowLCJjcCI6MCwicmMiOjAsImtqIjowLCJraSI6MCwic3MiOjAsInNqIjowLCJzc20iOjAsInNwIjowLCJ0cyI6MCwidGoiOjAsInRwIjowLCJ0c20iOjB9LCJzZXMiOnsicCI6MSwicyI6MTc1MTQ4MDYyODYwMywiZCI6MH19; _shopify_s=ddc42138-8ea3-4cd9-add0-0fdccd41a4f9; shopify_pay_redirect=pending; _dy_last_cart_sync=1751480628.987; OptanonConsent=isGpcEnabled=0&datestamp=Wed+Jul+02+2025+18%3A23%3A49+GMT%2B0000+(Coordinated+Universal+Time)&version=202404.1.0&browserGpcFlag=0&isIABGlobal=false&hosts=&landingPath=https%3A%2F%2Fwww.hillhousehome.com%2F&groups=C0001%3A1%2CC0002%3A1%2CC0003%3A1%2CC0004%3A1%2CC0005%3A1; _dy_app_jsession=jw2yzgdfwxv68o4v0kaszjthcw6rey86; _tracking_consent=3AM.PS_USDC_f_f_nAVMl-l-TGOvSRjPHux3HQ; _pin_unauth=dWlkPVlqaG1NRGswTm1JdE5URXhZUzAwWWpObUxXSTBOR0V0TWpOa04yTTJZVFJtTUdWaA; _vwo_ds=3%3At_0%2Ca_0%3A0%241751480625%3A15.53647835%3A%3A%3A%3A4; _dyid_server=-3652419051232855757; first_pla_call=first",
        "priority": "i",
        "referer": "https://www.hillhousehome.com/",
        "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"138\", \"Google Chrome\";v=\"138\"",
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "\"Unknown\"",
        "sec-fetch-dest": "image",
        "sec-fetch-mode": "no-cors",
        "sec-fetch-site": "same-origin",
        "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 PTST/250702.151337"
      },
      "initiator": {
        "type": "parser",
        "url": "https://www.hillhousehome.com/",
        "lineNumber": 8002,
        "columnNumber": 8
      },
      "documentURL": "https://www.hillhousehome.com/",
      "timestamp": 76141.64713,
      "frameId": "40A5B6CD55F7F754A7D59999313EBF8A",
      "hasUserGesture": false,
      "type": "Image",
      "wallTime": 1751480630.459924,
      "initialPriority": "Low",
      "priority": "Low",
      "transfer_size": 138253
    },
    "is_lcp_statically_discoverable": false,
    "is_lcp_preloaded": false,
    "lcp_preload": [],
    "web_vitals_js": [
      "https://www.hillhousehome.com/cdn/shopifycloud/perf-kit/shopify-perf-kit-1.6.6.min.js",
      "https://dev.visualwebsiteoptimizer.com/cdn/edrv/nc-7f73b1575ca1214a33f6bb1f2bfb6690.br.js",
      "https://cdn.shopify.com/shopifycloud/checkout-web/assets/c1.en/app.rndyD_a3.js"
    ],
    "gaming_metrics": {
      "fidIframeOverlaySoft": false
    },
    "speculation_rules": {
      "htmlRules": [],
      "httpHeaderRules": [
        {
          "url": "https://www.hillhousehome.com/cdn/shopifycloud/shopify/assets/storefront/storefronts.specrules-828df0376f942523726504d6cb4fbacd41a1db514689a84555c7d42872ee5363.json",
          "rule": {
            "tag": "shopify_storefront",
            "prefetch": [
              {
                "where": {
                  "or": [
                    {
                      "href_matches": "/(products|collections|pages|search|shop|blogs|policies){/*}?"
                    },
                    {
                      "href_matches": "/([a-z]{2,3}|zh-hans|zh-hant)(-[a-z]{2,3})?/(products|collections|pages|search|shop|blogs|policies){/*}?"
                    },
                    {
                      "href_matches": "/"
                    },
                    {
                      "href_matches": "/([a-z]{2,3}|zh-hans|zh-hant)(-[a-z]{2,3})?{/}?"
                    }
                  ]
                },
                "eagerness": "conservative"
              }
            ]
          }
        }
      ]
    }
  }
}
https://wordpress.com

WPT result details

Changed custom metrics values:

{
  "_performance": {
    "lcp_elem_stats": {
      "startTime": 1016,
      "nodeName": "IMG",
      "url": "https://wordpress.com/wp-content/uploads/2024/09/lohp-i3-hero-2x.png",
      "size": 251493,
      "loadTime": 625.5,
      "renderTime": 1016,
      "attributes": [
        {
          "name": "src",
          "value": "https://wordpress.com/wp-content/uploads/2024/09/lohp-i3-hero-2x.png"
        },
        {
          "name": "loading",
          "value": "eager"
        },
        {
          "name": "alt",
          "value": ""
        },
        {
          "name": "role",
          "value": "presentation"
        },
        {
          "name": "width",
          "value": "1272"
        },
        {
          "name": "height",
          "value": "966"
        }
      ],
      "boundingClientRect": {
        "x": 675.5,
        "y": 144,
        "width": 576,
        "height": 437.421875,
        "top": 144,
        "right": 1251.5,
        "bottom": 581.421875,
        "left": 675.5
      },
      "naturalWidth": 1272,
      "naturalHeight": 966,
      "styles": {
        "background-image": "none",
        "pointer-events": "auto",
        "position": "absolute",
        "width": "576px",
        "height": "437.422px"
      },
      "percentOfViewport": "0.271",
      "cover90viewport": false
    },
    "raw_lcp_element": {
      "nodeName": "IMG",
      "attributes": [
        {
          "name": "src",
          "value": "https://wordpress.com/wp-content/uploads/2024/09/lohp-i3-hero-2x.png"
        },
        {
          "name": "loading",
          "value": "eager"
        },
        {
          "name": "alt",
          "value": ""
        },
        {
          "name": "role",
          "value": "presentation"
        },
        {
          "name": "width",
          "value": "1272"
        },
        {
          "name": "height",
          "value": "966"
        }
      ]
    },
    "lcp_resource": {
      "id": "38617.8",
      "sequence": 5,
      "body": "/home/pmeenan/wptagent/work/wptagent-v6-manual-20241002-10.20.0.3/250702_PY_19.1.0/bodies/38617.8",
      "url": "https://wordpress.com/wp-content/uploads/2024/09/lohp-i3-hero-2x.png",
      "status": 200,
      "connectionId": 128,
      "protocol": "h2",
      "connectionReused": true,
      "fromServiceWorker": false,
      "timing": {
        "requestTime": 76298.622715,
        "proxyStart": -1,
        "proxyEnd": -1,
        "dnsStart": -1,
        "dnsEnd": -1,
        "connectStart": -1,
        "connectEnd": -1,
        "sslStart": -1,
        "sslEnd": -1,
        "workerStart": -1,
        "workerReady": -1,
        "workerFetchStart": -1,
        "workerRespondWithSettled": -1,
        "sendStart": 2.993,
        "sendEnd": 3.191,
        "pushStart": 0,
        "pushEnd": 0,
        "receiveHeadersStart": 76.336,
        "receiveHeadersEnd": 76.535
      },
      "fromDiskCache": false,
      "remoteIPAddress": "192.0.78.9",
      "remotePort": 443,
      "securityState": "secure",
      "securityDetails": {
        "protocol": "TLS 1.3",
        "keyExchange": "",
        "keyExchangeGroup": "X25519",
        "cipher": "AES_128_GCM",
        "certificateId": 0,
        "subjectName": "wordpress.com",
        "sanList": [
          "*.wordpress.com",
          "wordpress.com"
        ],
        "issuer": "E5",
        "validFrom": 1747079124,
        "validTo": 1754855123,
        "signedCertificateTimestampList": [
          {
            "status": "Verified",
            "origin": "Embedded in certificate",
            "logDescription": "Let's Encrypt 'Oak2025h2'",
            "logId": "0DE1F2302BD30DC140621209EA552EFC47747CB1D7E930EF0E421EB47E4EAA34",
            "timestamp": 1747082634315,
            "hashAlgorithm": "SHA-256",
            "signatureAlgorithm": "ECDSA",
            "signatureData": "3045022100FD37A2D141332073CD86C8F2CB7978FA872E48A8B7C63EF6E57ECEE5A04B7157022002D0BE8C0BF6DEA962F1B5FFD4A46EB2EE7B36A87A55EA1342E635D5DD7BD947"
          },
          {
            "status": "Verified",
            "origin": "Embedded in certificate",
            "logDescription": "Sectigo 'Sabre2025h2'",
            "logId": "1A04FF49D0541D40AFF6A0C3BFF1D8C4672F4EECEE234068986B17402EDC897D",
            "timestamp": 1747082635059,
            "hashAlgorithm": "SHA-256",
            "signatureAlgorithm": "ECDSA",
            "signatureData": "304402204923CCFB0B42BA0DC4C7A9A938E5571F30A883C18A277AF7131F93F95C6B5E8B022006A7AEC52F1944B9DE2D72422D75F1A92B1D796AFBE82B971CF59090503115F1"
          }
        ],
        "certificateTransparencyCompliance": "compliant",
        "serverSignatureAlgorithm": 1027,
        "encryptedClientHello": false
      },
      "fromPrefetchCache": false,
      "response_headers": {
        "accept-ranges": "bytes",
        "alt-svc": "h3=\":443\"; ma=86400",
        "content-length": "82898",
        "content-type": "image/png",
        "date": "Wed, 02 Jul 2025 18:26:27 GMT",
        "expires": "Sun, 27 Jul 2025 09:33:02 GMT",
        "last-modified": "Fri, 20 Sep 2024 13:57:24 GMT",
        "server": "nginx",
        "server-timing": "a8c-cdn, dc;desc=dca, cache;desc=BYPASS;dur=13.0",
        "strict-transport-security": "max-age=31536000; preload",
        "x-ac": "1.dca _dca BYPASS",
        "x-orig-src": "01_mogdir"
      },
      "request_headers": {
        ":authority": "wordpress.com",
        ":method": "GET",
        ":path": "/wp-content/uploads/2024/09/lohp-i3-hero-2x.png",
        ":scheme": "https",
        "accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
        "accept-encoding": "gzip, deflate, br, zstd",
        "accept-language": "en-US,en;q=0.9",
        "priority": "u=2, i",
        "referer": "https://wordpress.com/",
        "sec-ch-ua": "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"138\", \"Google Chrome\";v=\"138\"",
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": "\"Unknown\"",
        "sec-fetch-dest": "image",
        "sec-fetch-mode": "no-cors",
        "sec-fetch-site": "same-origin",
        "user-agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 PTST/250702.151337"
      },
      "initiator": {
        "type": "parser",
        "url": "https://wordpress.com/",
        "lineNumber": 1118,
        "columnNumber": 343
      },
      "documentURL": "https://wordpress.com/",
      "timestamp": 76298.621865,
      "frameId": "CEA4DC4EAC78D909ED24904071ACD06B",
      "hasUserGesture": false,
      "type": "Image",
      "wallTime": 1751480787.434661,
      "initialPriority": "Medium",
      "priority": "Medium",
      "transfer_size": 83290
    },
    "is_lcp_statically_discoverable": true,
    "is_lcp_preloaded": false,
    "lcp_preload": [],
    "web_vitals_js": [
      "https://wordpress.com/wp-content/js/bilmur.min.js?i=15&m=202527"
    ],
    "gaming_metrics": {
      "fidIframeOverlaySoft": false
    },
    "speculation_rules": {
      "htmlRules": [
        {
          "prefetch": [
            {
              "source": "document",
              "where": {
                "and": [
                  {
                    "href_matches": "/*"
                  },
                  {
                    "not": {
                      "href_matches": [
                        "/wp-*.php",
                        "/wp-admin/*",
                        "/files/*",
                        "/wp-content/*",
                        "/wp-content/plugins/*",
                        "/wp-content/themes/h4/*",
                        "/*\\?(.+)"
                      ]
                    }
                  },
                  {
                    "not": {
                      "selector_matches": "a[rel~=\"nofollow\"]"
                    }
                  },
                  {
                    "not": {
                      "selector_matches": ".no-prefetch, .no-prefetch a"
                    }
                  }
                ]
              },
              "eagerness": "conservative"
            }
          ]
        }
      ],
      "httpHeaderRules": []
    }
  }
}

@tunetheweb
Copy link
Member Author

LGTM. If the Sec-FetchDest` request header is available, it might be more accurate to use that but I'm not sure if the header is available at custom-metrics time.

Did both!

@tunetheweb tunetheweb merged commit c37f153 into main Jul 2, 2025
4 checks passed
@tunetheweb tunetheweb deleted the http-speculation-rules branch July 2, 2025 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve coverage of Speculation Rules custom metrics

3 participants