diff --git a/lighthouse-core/report/html/renderer/dom.js b/lighthouse-core/report/html/renderer/dom.js index 28de47bb246f..4f7b0a94db0d 100644 --- a/lighthouse-core/report/html/renderer/dom.js +++ b/lighthouse-core/report/html/renderer/dom.js @@ -127,8 +127,8 @@ class DOM { // Otherwise, append any links found. const url = new URL(segment.linkHref); - const DEVELOPERS_GOOGLE_ORIGIN = 'https://developers.google.com'; - if (url.origin === DEVELOPERS_GOOGLE_ORIGIN) { + const DOCS_ORIGINS = ['https://developers.google.com', 'https://web.dev']; + if (DOCS_ORIGINS.includes(url.origin)) { url.searchParams.set('utm_source', 'lighthouse'); url.searchParams.set('utm_medium', this._lighthouseChannel); } diff --git a/lighthouse-core/test/report/html/renderer/dom-test.js b/lighthouse-core/test/report/html/renderer/dom-test.js index 39a35b9603de..63fc457c39be 100644 --- a/lighthouse-core/test/report/html/renderer/dom-test.js +++ b/lighthouse-core/test/report/html/renderer/dom-test.js @@ -127,7 +127,14 @@ describe('DOM', () => { assert.equal(result.innerHTML, 'Learn more.'); }); - it('doesn\'t append utm params to non https://developers.google.com origins', () => { + it('appends utm params to the URLs with https://web.dev origin', () => { + const text = '[Learn more](https://web.dev/tap-targets/).'; + + const result = dom.convertMarkdownLinkSnippets(text); + assert.equal(result.innerHTML, 'Learn more.'); + }); + + it('doesn\'t append utm params to other (non-docs) origins', () => { const text = '[Learn more](https://example.com/info).'; const result = dom.convertMarkdownLinkSnippets(text);