Skip to content

Fix GA cookies and page views, translate artwork dates, finish the Chinese view - #5

Merged
geekplux merged 6 commits into
mainfrom
fix/analytics-and-i18n
Oct 16, 2026
Merged

geekplux merged 6 commits into
mainfrom
fix/analytics-and-i18n

Conversation

@geekplux

Copy link
Copy Markdown
Owner

Fixes the analytics and language problems found while checking that GA works on both sites.

Why

  • GA cookies were shared with Worldlines. gtag stored _ga on .geekplux.org, so both sites shared one client id. Declining here deleted Worldlines' cookies.
  • Chinese page views got the English title, and address changes added page views. The automatic page_view races app.js setting the title. Every ?lang / ?era / ?region change also logged a page view.
  • Artwork dates were English in the Chinese view. 45 of the 120 work dates contain words ("c. 3100 BCE", "19th century", "consecrated 547"), and all of them showed in English.
  • The address bar didn't match the language on screen. A saved Chinese preference showed Chinese at a plain /. Switching to English wrote ?lang=en, where Worldlines uses plain /.
  • Chinese view had English left in it. Five static screen-reader labels and the "Star" link stayed in English.

What changed (one commit each)

  1. Language in the address bar. A saved zh preference now rewrites / to /?lang=zh at start-up. Switching to English drops ?lang. An explicit ?lang=en link still wins over a saved preference and is never stripped.
  2. Page views and events.
    • send_page_view: false. pageView() sends the page view after render, on load and after a language switch, without the hash.
    • New track() helper.
    • select_content for a language switch, and for an era or region filter being turned on.
  3. Bilingual dates. All 120 y values 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.
  4. Screen-reader labels. data-i18n-aria on the 5 static labels.
  5. zh star label and tooltip. 星标.
  6. Host-only cookies. cookie_domain: "none". Docs updated.

⚠️ Owner steps

  1. GA4 setting. Admin → Data streams → (Art-isms stream) → Enhanced measurement → ⚙ → Page views → Show advanced settings → untick "Page changes based on browser history events". Until it is off, every language or filter change logs an extra page view.
  2. Review the Chinese dates below (all 120 are in the table). These are worth a second look:
    • "c. 1070s" → 约11世纪70年代. The only one where the digits differ.
    • "c. 36,000 years ago" → 约36000年前. The alternative is 约3.6万年前.
    • "consecrated 547" → 547年祝圣.
    • Discobolus → 约公元140年的复制品,原作为约公元前460–前450年的青铜像.

Expected side effects

  • New users will jump once. This comes from the cookie change. Visitors who still have the old shared .geekplux.org cookie keep that id until it expires or they decline.
  • Fewer page views. Filter clicks are no longer page views; they now send select_content.

Verification

  • Static checks. check-data passes. stamp-assets and seo.mjs produce no change. node --check passes.
  • Dates. A script confirmed all 120 English dates are unchanged from main. Every number in the English appears in the Chinese, apart from the 1070s case.
  • Layout. Checked at 1440px and 390px, in both languages and after switching. No horizontal scroll and no console errors. The English view shows no Chinese. The viewer shows long Chinese dates (Discobolus, San Vitale) with no overlap, with the newly merged viewer-frame fix included.
  • GA. Tested under the production hostname with the branch files, and every Google hit answered locally, so no data was sent.
    • One page view with the right title on / and on /?lang=zh.
    • Filter events fire only when a filter is turned on.
    • Cookies are host-only. Accept → gcs=G101. Decline removes them.
    • Declining here leaves Worldlines' cookies and client id intact.
  • Not tested: Safari, Firefox, real screen readers.

Left for the owner (not in this PR)

  • The raw HTML of /?lang=zh is English, and og tags are never localised. Same constraint as Worldlines: fixing it needs per-language HTML.
  • Already on main, not changed here:
    • Filter lists are percent-encoded in the URL (era=avant%2Cpost).
    • A direct #style link 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.

# Movement Work en zh
1 Prehistoric Art Chauvet Cave paintings c. 36,000 years ago 约36000年前
2 Prehistoric Art Venus of Willendorf c. 28,000–25,000 BCE 约公元前28000–前25000年
3 Prehistoric Art Lascaux cave paintings c. 17,000 years ago 约17000年前
4 Ancient Egyptian Art Narmer Palette c. 3100 BCE 约公元前3100年
5 Ancient Egyptian Art Bust of Nefertiti c. 1345 BCE 约公元前1345年
6 Ancient Egyptian Art Nebamun hunting in the marshes c. 1350 BCE 约公元前1350年
7 Indigenous Arts: Three Traditions Raven transformation mask 19th century 19世纪
8 Indigenous Arts: Three Traditions Katsina figure late 19th century 19世纪晚期
9 Indigenous Arts: Three Traditions Warlugulong 1977 1977年
10 Greek & Roman Classical Discobolus (Discus Thrower) c. 140 CE copy of a c. 460–450 BCE bronze 约公元140年的复制品,原作为约公元前460–前450年的青铜像
11 Greek & Roman Classical Parthenon frieze: horsemen c. 443–437 BCE 约公元前443–前437年
12 Greek & Roman Classical Augustus of Prima Porta early 1st century CE 公元1世纪初
13 African Sculptural Traditions Ife Head 14th–early 15th century 14世纪至15世纪初
14 African Sculptural Traditions Benin plaque: warrior and attendants c. 1540–1570 约1540–1570年
15 African Sculptural Traditions Nkisi nkondi (power figure) c. 1880–1900 约1880–1900年
16 Byzantine Art Christ Pantocrator (Sinai) 6th century 6世纪
17 Byzantine Art Basilica of San Vitale consecrated 547 547年祝圣
18 Byzantine Art Deësis mosaic, Hagia Sophia (detail: John the Baptist) c. 1261 约1261年
19 Islamic Art Folio from the Blue Qur’an 9th–10th century 9–10世纪
20 Islamic Art Ardabil Carpet 1539–1540 1539–1540年
21 Islamic Art Court of the Lions, Alhambra 14th century 14世纪
22 Chinese Landscape & Literati Painting Travelers Among Mountains and Streams c. 1000 约1000年
23 Chinese Landscape & Literati Painting Six Gentlemen 1345 1345年
24 Chinese Landscape & Literati Painting Lotus and Ducks c. 1696 约1696年
25 Romanesque Bayeux Tapestry c. 1070s 约11世纪70年代
26 Romanesque Last Judgment tympanum, Autun c. 1130 约1130年
27 Romanesque Central tympanum, Vézelay c. 1120–1132 约1120–1132年
28 Gothic Notre-Dame de la Belle Verrière (Blue Virgin window) c. 1150–1220 约1150–1220年
29 Gothic Visitation, Reims Cathedral c. 1230 约1230年
30 Gothic Wilton Diptych c. 1395–1399 约1395–1399年
31 Italian Renaissance The Birth of Venus c. 1484–1486 约1484–1486年
32 Italian Renaissance The Last Supper 1495–1498 1495–1498年
33 Italian Renaissance The School of Athens 1509–1511 1509–1511年
34 Northern Renaissance Arnolfini Portrait 1434 1434年
35 Northern Renaissance The Garden of Earthly Delights c. 1490–1500 约1490–1500年
36 Northern Renaissance The Hunters in the Snow 1565 1565年
37 Indian Miniature Painting Shuja’at Khan pursuing Asaf Khan on the Ganges, from the Akbarnama c. 1590–1595 约1590–1595年
38 Indian Miniature Painting Krishna and Radha in a Pavilion 1719 1719年
39 Indian Miniature Painting Savant Singh and Bani Thani as Krishna and Radha in a Palace Garden c. 1760 约1760年
40 Mannerism Madonna with the Long Neck 1534–1540 1534–1540年
41 Mannerism An Allegory with Venus and Cupid c. 1545 约1545年
42 Mannerism The Burial of the Count of Orgaz 1586–1588 1586–1588年
43 Baroque The Calling of Saint Matthew 1599–1600 1599–1600年
44 Baroque Ecstasy of Saint Teresa 1647–1652 1647–1652年
45 Baroque Las Meninas 1656 1656年
46 Ukiyo-e The Great Wave off Kanagawa c. 1831 约1831年
47 Ukiyo-e Sudden Shower over Shin-Ōhashi Bridge and Atake 1857 1857年
48 Ukiyo-e Three Beauties of the Present Day c. 1793 约1793年
49 Rococo The Swing c. 1767 约1767年
50 Rococo Pilgrimage to Cythera 1717 1717年
51 Rococo Madame de Pompadour 1759 1759年
52 Neoclassicism Oath of the Horatii 1784 1784年
53 Neoclassicism The Death of Marat 1793 1793年
54 Neoclassicism Grande Odalisque 1814 1814年
55 Romanticism Liberty Leading the People 1830 1830年
56 Romanticism The Slave Ship 1840 1840年
57 Romanticism Wanderer above the Sea of Fog c. 1818 约1818年
58 Realism The Stone Breakers 1849 1849年
59 Realism The Gleaners 1857 1857年
60 Realism The Third-Class Carriage c. 1862–1864 约1862–1864年
61 Impressionism Impression, Sunrise 1872 1872年
62 Impressionism Bal du moulin de la Galette 1876 1876年
63 Impressionism The Ballet Class 1873–1876 1873–1876年
64 Post-Impressionism The Starry Night 1889 1889年
65 Post-Impressionism Mont Sainte-Victoire and Château Noir c. 1904–1906 约1904–1906年
66 Post-Impressionism Vision of the Sermon (Jacob Wrestling with the Angel) 1888 1888年
67 Art Nouveau JOB cigarette paper poster 1896 1896年
68 Art Nouveau The Kiss c. 1907–1909 约1907–1909年
69 Art Nouveau Paris Métro entrance c. 1900 约1900年
70 Fauvism Woman with a Hat 1905 1905年
71 Fauvism Charing Cross Bridge 1906 1906年
72 Fauvism Le Bonheur de vivre (The Joy of Life) 1905–1906 1905–1906年
73 Expressionism The Scream 1893 1893年
74 Expressionism Street, Berlin 1913 1913年
75 Expressionism Self-Portrait with Physalis 1912 1912年
76 Cubism Still Life before an Open Window, Place Ravignan 1915 1915年
77 Cubism Les Baigneuses (The Bathers) 1912 1912年
78 Cubism En Canot (In the Boat) 1913 1913年
79 Futurism Unique Forms of Continuity in Space 1913 1913年
80 Futurism Dynamism of a Dog on a Leash 1912 1912年
81 Futurism Dynamism of a Car 1912–1913 1912–1913年
82 Suprematism & Constructivism Black Square 1915 1915年
83 Suprematism & Constructivism Monument to the Third International (Tatlin’s Tower) 1919–1920 1919–1920年
84 Suprematism & Constructivism Beat the Whites with the Red Wedge 1919–1920 1919–1920年
85 Dada Fountain 1917 1917年
86 Dada Cut with the Kitchen Knife 1919–1920 1919–1920年
87 Dada L’Œil cacodylate (The Cacodylic Eye) 1921 1921年
88 De Stijl / Neoplasticism Composition with Red, Blue and Yellow 1930 1930年
89 De Stijl / Neoplasticism Red and Blue Chair 1918–1923 1918–1923年
90 De Stijl / Neoplasticism Counter-Composition XIII 1925–1926 1925–1926年
91 Bauhaus Bauhaus Building, Dessau 1925–1926 1925–1926年
92 Bauhaus Wassily Chair (Model B3) 1925–1926 1925–1926年
93 Bauhaus Triadic Ballet 1922 1922年
94 Art Deco Chrysler Building 1928–1930 1928–1930年
95 Art Deco Christ the Redeemer 1922–1931 1922–1931年
96 Art Deco Self-Portrait in the Green Bugatti 1929 1929年
97 Latin American Modernisms The Two Fridas 1939 1939年
98 Latin American Modernisms Detroit Industry Murals 1932–1933 1932–1933年
99 Latin American Modernisms Abaporu 1928 1928年
100 Surrealism The Treachery of Images 1929 1929年
101 Surrealism The Persistence of Memory 1931 1931年
102 Surrealism The Storm (Black Landscape) 1926 1926年
103 Abstract Expressionism Autumn Rhythm (Number 30) 1950 1950年
104 Abstract Expressionism No. 61 (Rust and Blue) 1953 1953年
105 Abstract Expressionism The Liver Is the Cock’s Comb 1944 1944年
106 Pop Art Marilyn Diptych 1962 1962年
107 Pop Art El Cap de Barcelona (Barcelona Head) 1992 1992年
108 Pop Art Just what is it that makes today’s homes so different, so appealing? 1956 1956年
109 Minimalism Untitled (Stack) 1980 (stacks from 1965) 1980年(堆叠系列始于1965年)
110 Minimalism Equivalent VIII 1966 1966年
111 Minimalism “monument” for V. Tatlin 1964–1990 (this version 1969–1970) 1964–1990年(此版本1969–1970年)
112 Conceptual Art One and Three Chairs 1965 1965年
113 Conceptual Art Grapefruit 1964 1964年
114 Conceptual Art Today series (date paintings) from 1966 1966年起
115 Postmodernism Untitled Film Stills 1977–1980 1977–1980年
116 Postmodernism Puppy 1992 1992年
117 Postmodernism Untitled (Cowboy) 1989 1989年
118 Contemporary Art Infinity Mirror Rooms 1965–present 1965年至今
119 Contemporary Art Maman 1999 (this cast 2001) 1999年(此件铸于2001年)
120 Contemporary Art A Subtlety, or the Marvelous Sugar Baby 2014 2014年

🤖 Generated with Claude Code

geekplux and others added 6 commits October 16, 2026 11:23
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>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-analytics-and-i18n-artisms.fum.workers.dev (commit 4371ff1)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://05dfa308-artisms.fum.workers.dev 4371ff1 2026-10-16T15:35:39.790Z Visit the dashboard ↗

@geekplux
geekplux merged commit 6427350 into main Oct 16, 2026
3 checks passed
@geekplux
geekplux deleted the fix/analytics-and-i18n branch October 16, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant