@justai/core 0.37.0 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,6 +46,27 @@ export declare function measurementIdFor(host: string | null | undefined): strin
46
46
  * The region list has a sibling: the timezone list in the consent dialog's script. Change one and
47
47
  * the other must change, or a visitor is denied by region while never being offered the dialog.
48
48
  *
49
+ * `page_location` IS THE PAGE, PLUS THE CLICK THAT BROUGHT SOMEBODY TO IT — AND NOTHING ELSE.
50
+ *
51
+ * queries: paid clicks counted as organic · gclid stripped · cpc sessions dropped to zero · Google
52
+ * Ads clicks missing in GA4 · page_location query string · organic search too high
53
+ *
54
+ * 2026-07-27 set `page_location` to `origin + pathname`, so that a WiFi password base64'd into a
55
+ * qr link could never reach Google Analytics as the name of a page. Right, and still right. But
56
+ * GA4 reads the Google Ads click id — `gclid` — from `page_location` and from nowhere else, so the
57
+ * same line threw the click id away with the password. Measured on the property, week by week: the
58
+ * fleet rebuilt on this core in the first days of August, `cpc` sessions fell from ~330 a week to
59
+ * under 20 the week after, and `organic` rose by the same amount in the same week — while Google
60
+ * Ads went on reporting 400–690 paid clicks a week. Every paid visit since has been counted as
61
+ * organic search. The North Star readout (organic and direct growing while paid stays flat) was
62
+ * reading its own defect: Search Console, which cannot be fooled this way, showed 82 organic
63
+ * clicks in a month against GA4's 1,049 "organic" users.
64
+ *
65
+ * So the query is not dropped, it is FILTERED. What survives is the list below — Google's own click
66
+ * ids and the utm_* campaign labels — which are ours and the ad network's, never the visitor's.
67
+ * `?data=`, `?ref=`, `?lang=` and everything a person might have typed are still never sent. The
68
+ * spec in harness/tests/unit.spec.mjs pins both halves: the click id survives, the data does not.
69
+ *
49
70
  * `page_title` IS PINNED at load. Only one persona mutates `document.title` today — time shows a live
50
71
  * clock — and without this its analytics reports "13:32 · Amsterdam" as the page name. It costs every
51
72
  * other persona nothing and removes a trap the next persona that animates its tab would walk into.
package/dist/analytics.js CHANGED
@@ -95,6 +95,27 @@ export function measurementIdFor(host) {
95
95
  * The region list has a sibling: the timezone list in the consent dialog's script. Change one and
96
96
  * the other must change, or a visitor is denied by region while never being offered the dialog.
97
97
  *
98
+ * `page_location` IS THE PAGE, PLUS THE CLICK THAT BROUGHT SOMEBODY TO IT — AND NOTHING ELSE.
99
+ *
100
+ * queries: paid clicks counted as organic · gclid stripped · cpc sessions dropped to zero · Google
101
+ * Ads clicks missing in GA4 · page_location query string · organic search too high
102
+ *
103
+ * 2026-07-27 set `page_location` to `origin + pathname`, so that a WiFi password base64'd into a
104
+ * qr link could never reach Google Analytics as the name of a page. Right, and still right. But
105
+ * GA4 reads the Google Ads click id — `gclid` — from `page_location` and from nowhere else, so the
106
+ * same line threw the click id away with the password. Measured on the property, week by week: the
107
+ * fleet rebuilt on this core in the first days of August, `cpc` sessions fell from ~330 a week to
108
+ * under 20 the week after, and `organic` rose by the same amount in the same week — while Google
109
+ * Ads went on reporting 400–690 paid clicks a week. Every paid visit since has been counted as
110
+ * organic search. The North Star readout (organic and direct growing while paid stays flat) was
111
+ * reading its own defect: Search Console, which cannot be fooled this way, showed 82 organic
112
+ * clicks in a month against GA4's 1,049 "organic" users.
113
+ *
114
+ * So the query is not dropped, it is FILTERED. What survives is the list below — Google's own click
115
+ * ids and the utm_* campaign labels — which are ours and the ad network's, never the visitor's.
116
+ * `?data=`, `?ref=`, `?lang=` and everything a person might have typed are still never sent. The
117
+ * spec in harness/tests/unit.spec.mjs pins both halves: the click id survives, the data does not.
118
+ *
98
119
  * `page_title` IS PINNED at load. Only one persona mutates `document.title` today — time shows a live
99
120
  * clock — and without this its analytics reports "13:32 · Amsterdam" as the page name. It costs every
100
121
  * other persona nothing and removes a trap the next persona that animates its tab would walk into.
@@ -123,7 +144,7 @@ try{var __c=localStorage.getItem("consent");
123
144
  if(__c==="granted+ads")gtag("consent","update",{analytics_storage:"granted",ad_storage:"granted",ad_user_data:"granted"});
124
145
  else if(__c==="granted")gtag("consent","update",{analytics_storage:"granted"});
125
146
  else if(__c==="denied")gtag("consent","update",{analytics_storage:"denied",ad_storage:"denied",ad_user_data:"denied"})}catch(e){}
126
- gtag("config",__g,{cookie_expires:60*60*24*60,page_title:document.title,page_location:location.origin+location.pathname,allow_google_signals:false,allow_ad_personalization_signals:false});
147
+ gtag("config",__g,{cookie_expires:60*60*24*60,page_title:document.title,page_location:(function(){var q=new URLSearchParams(location.search),k=["gclid","gbraid","wbraid","dclid","utm_source","utm_medium","utm_campaign","utm_term","utm_content"],o=[];for(var i=0;i<k.length;i++){var v=q.get(k[i]);if(v)o.push(k[i]+"="+encodeURIComponent(v))}return location.origin+location.pathname+(o.length?"?"+o.join("&"):"")})(),allow_google_signals:false,allow_ad_personalization_signals:false});
127
148
  addEventListener("load",function(){(window.requestIdleCallback||function(f){setTimeout(f,1200)})(function(){var s=document.createElement("script");s.async=true;s.src="https://www.googletagmanager.com/gtag/js?id="+__g;document.head.appendChild(s)})});
128
149
  }})();`;
129
150
  }
package/dist/scroll.d.ts CHANGED
@@ -18,6 +18,18 @@ export interface PersonaScrollOptions {
18
18
  titleFor?: (id: string) => string;
19
19
  /** Whether this owns `body.ready`. Pass `false` on a page that renders asynchronously. */
20
20
  reveal?: boolean;
21
+ /**
22
+ * Which section a visit with no hash opens on. Defaults to `"kernel"`, which is right for every
23
+ * persona in the fleet: their kernel is the thing they do, and the profile above it is a header
24
+ * you scroll back to.
25
+ *
26
+ * app.zone is the exception this exists for. Its kernel is a catalogue of the OTHER personas, so
27
+ * landing there opens the house on a list of its rooms — the mark, the wordmark and the sentence
28
+ * that say what app.zone is scroll past before anyone reads them. Named rather than boolean so a
29
+ * persona can point at any of its own cuts; an id that is not on the page falls back to the
30
+ * kernel rather than landing nowhere.
31
+ */
32
+ landOn?: string;
21
33
  }
22
34
  export declare function personaScroll(options?: PersonaScrollOptions): void;
23
35
  export declare function personaScrollJs(options?: PersonaScrollOptions): string;
package/dist/scroll.js CHANGED
@@ -222,8 +222,12 @@ export function personaScroll(options) {
222
222
  const sentTo = (() => {
223
223
  const t = cuts.find((c) => "#" + c[0].id === location.hash);
224
224
  // A section hash is honoured on load and refresh; anything else — including #kernel and no hash
225
- // at all — lands on the kernel.
226
- return t ? t[0] : kernel;
225
+ // at all — lands on `landOn`, which is the kernel unless a persona says otherwise.
226
+ //
227
+ // The fallback chain is deliberate: an unknown id must not land the page nowhere. `el()` returns
228
+ // null for an id the page does not carry, and every caller downstream of this reads `sentTo` as
229
+ // a section that exists.
230
+ return t ? t[0] : (o.landOn ? el(o.landOn) : null) ?? kernel;
227
231
  })();
228
232
  const land = () => {
229
233
  // presentation mode owns the viewport — a page presenting itself does not scroll out from under
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justai/core",
3
- "version": "0.37.0",
4
- "description": "The framework-free heart of the persona shell \u2014 the load-bearing behaviour (auth capture, reveal, ready) as plain strings, so Astro and Next inject the SAME logic instead of each re-writing it.",
3
+ "version": "0.39.0",
4
+ "description": "The framework-free heart of the persona shell — the load-bearing behaviour (auth capture, reveal, ready) as plain strings, so Astro and Next inject the SAME logic instead of each re-writing it.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
7
7
  "type": "git",
@@ -10,8 +10,7 @@
10
10
  },
11
11
  "type": "module",
12
12
  "files": [
13
- "dist",
14
- "README.md"
13
+ "dist"
15
14
  ],
16
15
  "exports": {
17
16
  ".": {