From 1e292776efeb747b2c7a9d65523eeaab128bd211 Mon Sep 17 00:00:00 2001
From: omermorad
Date: Thu, 19 Nov 2026 07:59:43 +0200
Subject: [PATCH 1/4] Clarify Quick Start entry and validate adoption tracking
---
ANALYTICS.md | 19 ++-
package.json | 3 +-
pnpm-lock.yaml | 119 ++++++++++++++++++
.../islands/AdoptionAnalytics.astro | 17 +--
src/components/site/MarketingHeader.astro | 6 +-
src/lib/adoptionAnalytics.js | 26 ++++
src/pages/index.astro | 19 +--
tests/adoption-copy-integration.test.mjs | 83 ++++++++++++
8 files changed, 260 insertions(+), 32 deletions(-)
create mode 100644 tests/adoption-copy-integration.test.mjs
diff --git a/ANALYTICS.md b/ANALYTICS.md
index 455c689..b16350d 100644
--- a/ANALYTICS.md
+++ b/ANALYTICS.md
@@ -10,25 +10,32 @@ Analytics loads only for Netlify production builds.
| `installation_copy` | A successful code-block copy containing a Suites install command | Intent to install Suites |
| `test_example_copy` | A successful code-block copy containing a `TestBed.solitary()` or `TestBed.sociable()` example on a framework guide | Intent to try a framework example |
| `search_result_click` | Selecting a search result | Search helped the reader find a document |
+| `quickstart_click` | Selecting a homepage Quick Start link | Intent to start the first-test guide; `cta_location` identifies the header, mobile menu, hero, features, or footer |
Copy events send the page path and, for framework examples, the framework name. They never send copied code. They observe Expressive Code's successful clipboard feedback, so a failed copy does not count. Copies do not prove an installation or a passing test.
-Search opens, search results, and empty searches remain diagnostic events. The existing `ads_conversion_PAGE_VIEW_1` measures page-view conversions and must not be interpreted as adoption.
+Search opens, search results, empty searches, and Quick Start clicks remain diagnostic events. The existing `ads_conversion_PAGE_VIEW_1` measures page views and must not be interpreted as adoption.
## GA property setup
-After reviewing and deploying the branch:
+Property settings updated on **19 November 2026**:
-1. In **Admin > Data display > Events**, create or mark `installation_copy` and `test_example_copy` as key events. Use **Once per session** for each. GA allows registering event names before their first occurrence.
-2. Under **Custom definitions**, create an event-scoped dimension named **Framework**, with event parameter `framework`.
-3. Keep `search_result_click` available for search reporting. Do not treat search activity alone as installation intent.
+1. Removed the key-event flag from `ads_conversion_PAGE_VIEW_1`. The event remains available as an ordinary event. GA warned that unmarking also stops future conversion association in linked accounts, including Google Ads. Historical data remains unchanged.
+2. Registered `installation_copy` and `test_example_copy` as code-based key events, counted **Once per session**, with no default monetary value. No page-view-derived event rules were created.
+3. Registered event-scoped dimensions: **Framework** for `framework`, **CTA location** for `cta_location`, and **Search term** for `search_term`.
+4. Keep `search_result_click` and `quickstart_click` available for diagnostic reporting rather than marking them as adoption key events.
+5. Added a 19 November annotation in GA documenting the conversion and engagement baseline change.
-Property setup is separate from the website code. Check the GA interface for the registered definitions before treating setup as complete. Key-event registration applies to future events, not historical data.
+Property setup is separate from the website code. The Quick Start click event and CTA changes require this branch to be deployed. Key-event registration and custom dimensions apply to future data, not historical data. The built-in `purchase` key event remains unchanged.
+
+GA counts a session as engaged when it has a key event. Before this correction, every docs page view generated `ads_conversion_PAGE_VIEW_1`, so engagement and conversion rates overstated meaningful activity. Compare engagement against the new baseline from 19 November, rather than interpreting a subsequent fall as a website regression.
## Validate without polluting production data
In a local build with `CONTEXT=production`, block Google tag network requests and stub `window.gtag` to capture calls. Copy a Suites install command and a framework test example. Each successful copy should emit the corresponding event; unrelated code and failed copies should emit neither event. A normal preview build must load no Google tag.
+`pnpm test` includes DOM integration tests that execute the installed Expressive Code copy-button script together with the adoption observer. They cover successful install and test-example copies, repeated successful copies, clipboard failure, unrelated snippets, and unrelated feedback. Test events stay in memory and never reach GA.
+
Run `pnpm test`, `pnpm check`, and `CONTEXT=production pnpm build` for automated checks.
## Compare launch performance
diff --git a/package.json b/package.json
index 1aac44d..7e2a55d 100644
--- a/package.json
+++ b/package.json
@@ -37,7 +37,8 @@
},
"devDependencies": {
"@types/react": "^18.3.0",
- "@types/react-dom": "^18.3.0"
+ "@types/react-dom": "^18.3.0",
+ "linkedom": "^0.18.15"
},
"engines": {
"node": ">=22",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index a4ed115..345aacc 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -57,6 +57,9 @@ importers:
'@types/react-dom':
specifier: ^18.3.0
version: 18.3.7(@types/react@18.3.28)
+ linkedom:
+ specifier: ^0.18.15
+ version: 0.18.15
packages:
@@ -1342,6 +1345,10 @@ packages:
boolbase@1.0.0:
resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==}
+ boolbase@2.0.0:
+ resolution: {integrity: sha512-DkVaaQHymRhpYEYo9x1oo7Q7B0Y6KJUsjm3c9eTyFDby4MHLBTwZ6ZDWBel5zrYxj1WsZgC5oLpiz+93MluXeA==}
+ engines: {node: '>=20.19.0'}
+
boxen@8.0.1:
resolution: {integrity: sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==}
engines: {node: '>=18'}
@@ -1462,6 +1469,10 @@ packages:
css-select@5.2.2:
resolution: {integrity: sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==}
+ css-select@7.0.0:
+ resolution: {integrity: sha512-snmjEVXy+1LnwXdxhYvTMj1d9tOh4HxkA1YmoayVBeeyR2C14Pum7fcxJIm4SswYspVy866eYNwlH6xC3/VH5g==}
+ engines: {node: '>=20.19.0'}
+
css-selector-parser@3.3.0:
resolution: {integrity: sha512-Y2asgMGFqJKF4fq4xHDSlFYIkeVfRsm69lQC1q9kbEsH5XtnINTMrweLkjYMeaUgiXBy/uvKeO/a1JHTNnmB2g==}
@@ -1477,6 +1488,10 @@ packages:
resolution: {integrity: sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==}
engines: {node: '>= 6'}
+ css-what@8.0.0:
+ resolution: {integrity: sha512-DH0Bqq3DNp5tdOReuNyAA+Ev4Y2GS5FMbZpeTLP6C4CDi0h5nL0BmUPChXw3o/qbHLDWHl49sbNqQVY7bMSDdw==}
+ engines: {node: '>=20.19.0'}
+
cssesc@3.0.0:
resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==}
engines: {node: '>=4'}
@@ -1486,6 +1501,10 @@ packages:
resolution: {integrity: sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==}
engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0, npm: '>=7.0.0'}
+ cssomnom@0.1.12:
+ resolution: {integrity: sha512-nlsLjRxRN2RPomw3r+e+oD3KQBbEbKK0+oBUATbodf5N38FlOMg/5nqV0CdClNvpVsjFLikD63H6dgKTgeuuUg==}
+ engines: {node: '>=20.0.0'}
+
csstype@3.2.3:
resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}
@@ -1701,19 +1720,35 @@ packages:
dom-serializer@2.0.0:
resolution: {integrity: sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==}
+ dom-serializer@3.1.1:
+ resolution: {integrity: sha512-4MEa38/QexBob6gFNwu+EGdWvhJ1OKuNwdYY3Y3NyeWDQfnGeDYQUDfIRzWu5B5gsv03so2Uxd28YC6zrsx3Lw==}
+ engines: {node: '>=20.19.0'}
+
domelementtype@2.3.0:
resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==}
+ domelementtype@3.0.0:
+ resolution: {integrity: sha512-umCQid3jKbDmVjx8jGaW7uUykm4DEUeyV21hPxNMo2nV955DhUThwqyOIDtreepP31hl84X7G5U9ZfsWvIB3Pg==}
+ engines: {node: '>=20.19.0'}
+
domhandler@5.0.3:
resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==}
engines: {node: '>= 4'}
+ domhandler@6.0.1:
+ resolution: {integrity: sha512-gYzvtM72ZtxQO0T048kd6HWSbbGCNOUwcnfQ01cqIJ4X2IYKFFHZ5mKvrQETcFXxsRObZulDaKmy//R7TPtsBg==}
+ engines: {node: '>=20.19.0'}
+
dompurify@3.3.3:
resolution: {integrity: sha512-Oj6pzI2+RqBfFG+qOaOLbFXLQ90ARpcGG6UePL82bJLtdsa6CYJD7nmiU8MW9nQNOtCHV3lZ/Bzq1X0QYbBZCA==}
domutils@3.2.2:
resolution: {integrity: sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==}
+ domutils@4.0.2:
+ resolution: {integrity: sha512-qI4JLRKnSzqFqr7hAlS5xQDusBCjKSEG4t4+7aNrIQMHBcsC2TGEhuyABJdYkgSewL57PNLYEiibY2iPKhKpaA==}
+ engines: {node: '>=20.19.0'}
+
dset@3.1.4:
resolution: {integrity: sha512-2QF/g9/zTaPDc3BjNcVTGoBbXBgYfMTTceLaYcFJ/W9kggFUkhxD/hMEeuLKbugyef9SqAx8cpgwlIP/jinUTA==}
engines: {node: '>=4'}
@@ -1741,6 +1776,14 @@ packages:
resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==}
engines: {node: '>=0.12'}
+ entities@7.0.1:
+ resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==}
+ engines: {node: '>=0.12'}
+
+ entities@8.1.0:
+ resolution: {integrity: sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==}
+ engines: {node: '>=20.19.0'}
+
es-module-lexer@1.7.0:
resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==}
@@ -1904,6 +1947,9 @@ packages:
html-void-elements@3.0.0:
resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==}
+ htmlparser2@10.1.0:
+ resolution: {integrity: sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==}
+
http-cache-semantics@4.2.0:
resolution: {integrity: sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==}
@@ -2012,6 +2058,15 @@ packages:
layout-base@2.0.1:
resolution: {integrity: sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg==}
+ linkedom@0.18.15:
+ resolution: {integrity: sha512-o0w7eD/SvoCao+pUi6dzocCLuMR11g4Tv/et0W2OUzwWmUcewntSzyl+Ua/K+0yKym0Y/Mav3nFAaI5Av5jvZg==}
+ engines: {node: '>=16'}
+ peerDependencies:
+ canvas: '>= 2'
+ peerDependenciesMeta:
+ canvas:
+ optional: true
+
lodash-es@4.17.23:
resolution: {integrity: sha512-kVI48u3PZr38HdYz98UmfPnXl2DXrpdctLrFLCd3kOx1xUkOmpFPx7gCWWM5MPkL/fD8zb+Ph0QzjGFs4+hHWg==}
@@ -2256,6 +2311,10 @@ packages:
nth-check@2.1.1:
resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==}
+ nth-check@3.0.1:
+ resolution: {integrity: sha512-GX0gsdbGVCgnRgbeGaubfjpBXyYRWOOCVeYh08bSQvDZqxz5ndXs1OTfAt/h36G1xvI94YIspsI0sVFqAV9+RQ==}
+ engines: {node: '>=20.19.0'}
+
ofetch@1.5.1:
resolution: {integrity: sha512-2W4oUZlVaqAPAil6FUg/difl6YhqhUR7x2eZY4bQCko22UXg3hptq9KLQdqFClV+Wu85UX7hNtdGTngi/1BxcA==}
@@ -2635,6 +2694,9 @@ packages:
ufo@1.6.3:
resolution: {integrity: sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==}
+ uhyphen@0.2.0:
+ resolution: {integrity: sha512-qz3o9CHXmJJPGBdqzab7qAYuW8kQGKNEuoHFYrBwV6hWIMcpAmxDLXojcHfFr9US1Pe6zUswEIJIbLI610fuqA==}
+
ultrahtml@1.6.0:
resolution: {integrity: sha512-R9fBn90VTJrqqLDwyMph+HGne8eqY1iPfYhPzZrvKpIfwkWZbcYlfpsb8B9dTvBfpy1/hqAD7Wi8EKfP9e8zdw==}
@@ -4386,6 +4448,8 @@ snapshots:
boolbase@1.0.0: {}
+ boolbase@2.0.0: {}
+
boxen@8.0.1:
dependencies:
ansi-align: 3.0.1
@@ -4501,6 +4565,14 @@ snapshots:
domutils: 3.2.2
nth-check: 2.1.1
+ css-select@7.0.0:
+ dependencies:
+ boolbase: 2.0.0
+ css-what: 8.0.0
+ domhandler: 6.0.1
+ domutils: 4.0.2
+ nth-check: 3.0.1
+
css-selector-parser@3.3.0: {}
css-tree@2.2.1:
@@ -4515,12 +4587,16 @@ snapshots:
css-what@6.2.2: {}
+ css-what@8.0.0: {}
+
cssesc@3.0.0: {}
csso@5.0.5:
dependencies:
css-tree: 2.2.1
+ cssomnom@0.1.12: {}
+
csstype@3.2.3: {}
cytoscape-cose-bilkent@4.1.0(cytoscape@3.33.1):
@@ -4752,12 +4828,24 @@ snapshots:
domhandler: 5.0.3
entities: 4.5.0
+ dom-serializer@3.1.1:
+ dependencies:
+ domelementtype: 3.0.0
+ domhandler: 6.0.1
+ entities: 8.1.0
+
domelementtype@2.3.0: {}
+ domelementtype@3.0.0: {}
+
domhandler@5.0.3:
dependencies:
domelementtype: 2.3.0
+ domhandler@6.0.1:
+ dependencies:
+ domelementtype: 3.0.0
+
dompurify@3.3.3:
optionalDependencies:
'@types/trusted-types': 2.0.7
@@ -4768,6 +4856,12 @@ snapshots:
domelementtype: 2.3.0
domhandler: 5.0.3
+ domutils@4.0.2:
+ dependencies:
+ dom-serializer: 3.1.1
+ domelementtype: 3.0.0
+ domhandler: 6.0.1
+
dset@3.1.4: {}
electron-to-chromium@1.5.355: {}
@@ -4787,6 +4881,10 @@ snapshots:
entities@6.0.1: {}
+ entities@7.0.1: {}
+
+ entities@8.1.0: {}
+
es-module-lexer@1.7.0: {}
esast-util-from-estree@2.0.0:
@@ -5112,6 +5210,13 @@ snapshots:
html-void-elements@3.0.0: {}
+ htmlparser2@10.1.0:
+ dependencies:
+ domelementtype: 2.3.0
+ domhandler: 5.0.3
+ domutils: 3.2.2
+ entities: 7.0.1
+
http-cache-semantics@4.2.0: {}
iconv-lite@0.6.3:
@@ -5191,6 +5296,14 @@ snapshots:
layout-base@2.0.1: {}
+ linkedom@0.18.15:
+ dependencies:
+ css-select: 7.0.0
+ cssomnom: 0.1.12
+ html-escaper: 3.0.3
+ htmlparser2: 10.1.0
+ uhyphen: 0.2.0
+
lodash-es@4.17.23: {}
lodash-es@4.18.1: {}
@@ -5717,6 +5830,10 @@ snapshots:
dependencies:
boolbase: 1.0.0
+ nth-check@3.0.1:
+ dependencies:
+ boolbase: 2.0.0
+
ofetch@1.5.1:
dependencies:
destr: 2.0.5
@@ -6225,6 +6342,8 @@ snapshots:
ufo@1.6.3: {}
+ uhyphen@0.2.0: {}
+
ultrahtml@1.6.0: {}
uncrypto@0.1.3: {}
diff --git a/src/components/islands/AdoptionAnalytics.astro b/src/components/islands/AdoptionAnalytics.astro
index 2057924..550bbc5 100644
--- a/src/components/islands/AdoptionAnalytics.astro
+++ b/src/components/islands/AdoptionAnalytics.astro
@@ -1,21 +1,8 @@
diff --git a/src/components/site/MarketingHeader.astro b/src/components/site/MarketingHeader.astro
index 2d79d46..5ee0f8e 100644
--- a/src/components/site/MarketingHeader.astro
+++ b/src/components/site/MarketingHeader.astro
@@ -15,7 +15,7 @@ import Topbar from '@/components/ui/Topbar.astro';
import ThemeToggle from '@/components/site/ThemeToggle.astro';
const marketingNavLinks = [
- { label: 'Documentation', href: '/docs/get-started/' },
+ { label: 'Documentation', href: '/docs/' },
{ label: 'Quick start', href: '/docs/get-started/quickstart/' },
{
label: 'Examples',
@@ -44,6 +44,8 @@ const marketingMobileResources = [
{link.label}
@@ -81,6 +83,8 @@ const marketingMobileResources = [
{link.label}
diff --git a/src/lib/adoptionAnalytics.js b/src/lib/adoptionAnalytics.js
index f83a426..ef5341c 100644
--- a/src/lib/adoptionAnalytics.js
+++ b/src/lib/adoptionAnalytics.js
@@ -19,3 +19,29 @@ export function copiedCodeEvent(pathname, code) {
return { name: 'test_example_copy', params: { page_path: pathname, framework } };
}
}
+
+/**
+ * Observe the success feedback emitted by Expressive Code after copying.
+ * @param {Document} root
+ * @param {() => string} pathname
+ * @param {(name: string, params: Record) => void} send
+ */
+export function observeCodeCopies(root, pathname, send) {
+ const view = root.defaultView;
+ if (!view) return () => {};
+ const observer = new view.MutationObserver(records => {
+ for (const record of records) {
+ for (const node of record.addedNodes) {
+ if (!(node instanceof view.HTMLElement) || !node.matches('.feedback')) continue;
+ const button = node.parentElement?.matches('.expressive-code .copy')
+ ? node.parentElement.querySelector('button[data-code]')
+ : null;
+ if (!button) continue;
+ const event = copiedCodeEvent(pathname(), button.getAttribute('data-code') ?? '');
+ if (event) send(event.name, event.params);
+ }
+ }
+ });
+ observer.observe(root.body, { childList: true, subtree: true });
+ return () => observer.disconnect();
+}
diff --git a/src/pages/index.astro b/src/pages/index.astro
index 997c313..cc2dbc8 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -148,7 +148,7 @@ const { unit, unitRef } = await TestBed
-
Open source. Built for dependency injection.
+
Choose your framework. Follow a complete test example.
user.service.spec.tsTypeScript
@@ -240,7 +240,7 @@ const { unit, unitRef } = await TestBed
Create the unit and its dependency mocks in one step. Keep setup
short so the behavior you arrange, run, and assert is easy to find.
-
+
See quick start →