@xingwangzhe/stalux 1.29.7 → 1.29.8
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/README.md
CHANGED
|
@@ -172,7 +172,7 @@ bingClarityId: "YOUR_CLARITY_PROJECT_ID"
|
|
|
172
172
|
|
|
173
173
|
> The Partytown migration in this branch is an unpublished candidate. Representative route measurements show lower TBT, but LCP regresses on the homepage and category page, so performance validation is incomplete. The following describes the candidate implementation.
|
|
174
174
|
|
|
175
|
-
`stalux()` includes Partytown. The Google Analytics, Clarity,
|
|
175
|
+
`stalux()` includes Partytown. The Google Analytics, Clarity, and Umami scripts run in a Web Worker without an additional consumer integration. Page tracking follows `astro:page-load`; browsers with `Element.moveBefore()` preserve the worker during navigation. Vercount loads asynchronously in the main window, avoiding worker startup and DOM bridge delays for visible counters. It runs once after each `astro:page-load` to bind incoming page counters and use the current URL and first-party visitor cookie.
|
|
176
176
|
|
|
177
177
|
For Google Analytics, turn off **Page changes based on browser history events** under **Admin → Data streams → Enhanced measurement → Page views → Advanced settings**. Stalux sets `send_page_view: false` and sends the URL and title for each navigation explicitly. GA's history tracking must also be disabled in the property to prevent duplicate soft-navigation pageviews. Other enhanced measurement options can remain enabled. See [Google's pageview documentation](https://developers.google.com/analytics/devguides/collection/ga4/views).
|
|
178
178
|
|
package/package.json
CHANGED
|
@@ -67,7 +67,9 @@ const archiveYears = [...archivesByYearMonth.entries()]
|
|
|
67
67
|
{archiveYear.months.map(({ month, posts: monthPosts }) => (
|
|
68
68
|
<div
|
|
69
69
|
class={styles.monthSection}
|
|
70
|
-
style={{
|
|
70
|
+
style={{
|
|
71
|
+
"--archive-estimate": `${Math.ceil(monthPosts.length / 12) * 12 * 48 + 40}px`,
|
|
72
|
+
}}
|
|
71
73
|
>
|
|
72
74
|
<h3 class={styles.monthTitle}>{t("archives.month", { n: month })}</h3>
|
|
73
75
|
{Array.from({ length: Math.ceil(monthPosts.length / 12) }, (_, index) =>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Keep
|
|
2
|
+
* Keep analytics trackers in Partytown. This small main-thread bridge owns the
|
|
3
3
|
* Astro navigation lifecycle and tells the worker about each completed page.
|
|
4
4
|
*/
|
|
5
5
|
declare global {
|
|
@@ -116,12 +116,15 @@ function trackUmamiPage(): void {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
function trackVercountPage(): void {
|
|
119
|
-
//
|
|
120
|
-
//
|
|
119
|
+
// Visible counters need the current window's URL, cookie and DOM nodes.
|
|
120
|
+
// Avoid worker startup and synchronous DOM bridges; bind fresh nodes once
|
|
121
|
+
// per completed Astro navigation using the small upstream async script.
|
|
121
122
|
document.querySelector("script[data-stalux-vercount]")?.remove();
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
const script = document.createElement("script");
|
|
124
|
+
script.async = true;
|
|
125
|
+
script.src = "https://events.vercount.one/js";
|
|
126
|
+
script.dataset.staluxVercount = "true";
|
|
127
|
+
document.head.appendChild(script);
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
if (!state.installed) {
|