Repository navigation
Fix GA cookies and page views, translate artwork dates, finish the Chinese view - #5
Merged
Merged
Conversation
A visitor with a saved Chinese preference who opened plain / saw Chinese while the address said /, so a copied link opened in English. Rewrite the URL to /?lang=zh at start-up, and drop ?lang when switching to English so English is always plain /. An explicit ?lang=en is still honoured on load, so such a link keeps beating a saved Chinese preference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Art-isms and Worldlines both set _ga on .geekplux.org, so they shared a client id and declining on one site deleted the other's cookies. Set cookie_domain to the host. The automatic page_view raced app.js setting the Chinese title, so turn it off and send page_view from app.js after render (and after a language switch), without the #style hash. Also count language switches and era/region filters turned on, as select_content with ids only. The GA4 stream setting "Page changes based on browser history events" must be off, or replaceState for ?lang/?era/?region logs extra page views; README says where to find it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each work's date (y) was a plain English string, so the Chinese view
showed "c. 3100 BCE", "19th century" or "consecrated 547" untranslated.
Make all 120 dates { en, zh } pairs, following the conventions of the
styles' own year ranges (约, 公元前, 世纪, 年); every number is unchanged.
check-data now requires both languages for y, app.js renders the current
language, and seo.mjs keeps using the English text, so the generated
static HTML is byte-identical.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Five landmark and control labels in index.html (Sections, Language, Five works from the atlas, Contents, Jump to a style) stayed English in the Chinese view, so screen readers announced English in a Chinese page. Mark them with data-i18n-aria and set them from the UI strings in applyStatic(); the English text stays in the HTML for crawlers and no-JS visitors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Chinese view showed the English word "Star" on the GitHub link and in its tooltip. Use 星标, GitHub's own Chinese term, in both. The label is hidden at 480px and below, so phone widths are unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cookie_domain: location.hostname makes gtag write _ga with Domain=.artisms.geekplux.org, a domain cookie rather than the host-only cookie the docs promised. cookie_domain: "none" omits the Domain attribute (verified on Worldlines). The Decline handler already deletes host-only cookies through its no-domain variant, so it is unchanged. The docs now say this, and that only query changes (?lang, ?era, ?region) create history page views; hash-only changes do not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🚀 Deploying Preview to Cloudflare 🚀Preview URL: https://fix-analytics-and-i18n-artisms.fum.workers.dev (commit 4371ff1)This URL reflects your latest Preview deploymentPreview Deployments by commit
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the analytics and language problems found while checking that GA works on both sites.
Why
_gaon.geekplux.org, so both sites shared one client id. Declining here deleted Worldlines' cookies.page_viewracesapp.jssetting the title. Every?lang/?era/?regionchange also logged a page view./. Switching to English wrote?lang=en, where Worldlines uses plain/.What changed (one commit each)
/to/?lang=zhat start-up. Switching to English drops?lang. An explicit?lang=enlink still wins over a saved preference and is never stripped.send_page_view: false.pageView()sends the page view after render, on load and after a language switch, without the hash.track()helper.select_contentfor a language switch, and for an era or region filter being turned on.yvalues are now{ en, zh }. Also updated:check-data(validates both languages),seo.mjs(w.y.en; the static HTML is byte-identical), both render sites, and the README.data-i18n-ariaon the 5 static labels.星标.cookie_domain: "none". Docs updated.Expected side effects
.geekplux.orgcookie keep that id until it expires or they decline.select_content.Verification
check-datapasses.stamp-assetsandseo.mjsproduce no change.node --checkpasses.main. Every number in the English appears in the Chinese, apart from the 1070s case./and on/?lang=zh.gcs=G101. Decline removes them.Left for the owner (not in this PR)
/?lang=zhis English, and og tags are never localised. Same constraint as Worldlines: fixing it needs per-language HTML.main, not changed here:era=avant%2Cpost).#stylelink hides its heading under the sticky filter bar.All 120 artwork dates, English → Chinese
Generated for review. Numbers are unchanged; only the wording is translated.
🤖 Generated with Claude Code