@justai/core 0.38.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.
- package/dist/analytics.d.ts +21 -0
- package/dist/analytics.js +22 -1
- package/package.json +2 -3
package/dist/analytics.d.ts
CHANGED
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justai/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
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": {
|
|
@@ -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
|
".": {
|