Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Site: download clicks are counted by platform and button, with no cookies

Eric Brownroutb9a03dd51026
diff --git a/site/content/shell.html b/site/content/shell.html
index ca7761ab..17202dd2 100644
--- a/site/content/shell.html
+++ b/site/content/shell.html
@@ -1,6 +1,8 @@
<!DOCTYPE html>
-<html data-theme="light" {{pageHero}} lang="en"><head><meta charset="utf-8"/><meta content="width=device-width,initial-scale=1" name="viewport"/><title>{{pageTitle}}</title><meta content="{{pageDescription}}" name="description"/><link href="/marketing/assets/favicon-32.png" rel="icon" type="image/png" sizes="32x32"/><link href="/marketing/assets/favicon.svg" rel="icon" type="image/svg+xml" sizes="any"/><link href="/marketing/assets/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180"/><noscript><style>html .fragment-art picture{opacity:1!important}html .hero-still{display:block!important}html .product-window{visibility:visible!important}html .signal-wings{visibility:visible!important}html .transcript-turn,html .stream-word,html .summary-reveal,html .summary-reveal.action-item>i,html .result-paper .ready-label,html .result-check,html .answer-result{opacity:1;filter:none;transform:none}html .result-paper .writing-label{opacity:0}html .process-art *,html .roster-asset *{animation:none;transition:none}</style></noscript><link href="https://yogurt.so{{pagePath}}" rel="canonical"/><meta content="#ffffff" name="theme-color"/><script>
+<html data-theme="light" {{pageHero}} lang="en"><head><meta charset="utf-8"/>
+<meta name="referrer" content="strict-origin"/>
+<meta content="width=device-width,initial-scale=1" name="viewport"/><title>{{pageTitle}}</title><meta content="{{pageDescription}}" name="description"/><link href="/marketing/assets/favicon-32.png" rel="icon" type="image/png" sizes="32x32"/><link href="/marketing/assets/favicon.svg" rel="icon" type="image/svg+xml" sizes="any"/><link href="/marketing/assets/apple-touch-icon.png" rel="apple-touch-icon" sizes="180x180"/><noscript><style>html .fragment-art picture{opacity:1!important}html .hero-still{display:block!important}html .product-window{visibility:visible!important}html .signal-wings{visibility:visible!important}html .transcript-turn,html .stream-word,html .summary-reveal,html .summary-reveal.action-item>i,html .result-paper .ready-label,html .result-check,html .answer-result{opacity:1;filter:none;transform:none}html .result-paper .writing-label{opacity:0}html .process-art *,html .roster-asset *{animation:none;transition:none}</style></noscript><link href="https://yogurt.so{{pagePath}}" rel="canonical"/><meta content="#ffffff" name="theme-color"/><script>
(function(){
if(new URLSearchParams(location.search).get('static')==='1')document.documentElement.dataset.heroStatic='true';
var theme=matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';
diff --git a/site/package.json b/site/package.json
index ba276bf8..bb206a41 100644
--- a/site/package.json
+++ b/site/package.json
@@ -9,7 +9,7 @@
"site:bundle": "node scripts/bundle.mjs",
"site:stars": "node scripts/stars-snapshot.mjs --save",
"site:stills": "node scripts/stills.mjs",
- "test": "node renderer/timeline.test.mjs && node scripts/ribbon-geometry.test.mjs && node scripts/hero-entry.test.mjs && node scripts/headline.test.mjs && node scripts/theme.test.mjs && node scripts/hero-theme.test.mjs && node scripts/stars.test.mjs && node scripts/walkthrough.test.mjs && node scripts/features.test.mjs && node scripts/navigation.test.mjs && node scripts/updates.test.mjs && node scripts/llms.test.mjs && node scripts/home-metadata.test.mjs && node scripts/indexnow.test.mjs"
+ "test": "node renderer/timeline.test.mjs && node scripts/ribbon-geometry.test.mjs && node scripts/hero-entry.test.mjs && node scripts/headline.test.mjs && node scripts/theme.test.mjs && node scripts/hero-theme.test.mjs && node scripts/stars.test.mjs && node scripts/walkthrough.test.mjs && node scripts/features.test.mjs && node scripts/navigation.test.mjs && node scripts/updates.test.mjs && node scripts/llms.test.mjs && node scripts/home-metadata.test.mjs && node scripts/indexnow.test.mjs && node scripts/download-clicks.test.mjs"
},
"dependencies": {
"next": "16.4.5",
diff --git a/site/public/marketing/downloads.mjs b/site/public/marketing/downloads.mjs
index 89d83c46..2c236911 100644
--- a/site/public/marketing/downloads.mjs
+++ b/site/public/marketing/downloads.mjs
@@ -33,6 +33,43 @@ export function platformFor(userAgent,mobile=false,maxTouchPoints=0){
if(/Linux/i.test(userAgent)&&!/Android/i.test(userAgent))return 'linux'
return 'mac'
}
+// Enrich actual installer links after platform detection and mobile menu creation.
+export function countDownloadClicks(root, analytics) {
+ const regions = [
+ ['.mobile-download-list', 'mobile chooser'], ['.site-header', 'nav'],
+ ['.hero', 'hero'], ['.site-footer', 'footer'], ['.updates-page', 'updates'],
+ ]
+ for (const [platform, installer] of Object.entries(platforms)) {
+ for (const link of root.querySelectorAll(`a[href="${release + installer.file}"]`)) {
+ const region = regions.find(([selector]) => link.closest(selector))
+ if (region) Object.assign(link.dataset, { downloadPlatform: platform, downloadPlacement: region[1] })
+ }
+ }
+
+ try {
+ analytics('beforeSend', event => {
+ if (event.type !== 'event') return event
+ // The provider attaches the page URL and external referrer to custom events.
+ // Its hook can rewrite the former but cannot redact the latter.
+ const url = new URL(event.url)
+ if (root.referrer) {
+ const referrer = new URL(root.referrer)
+ if (referrer.origin !== url.origin && referrer.href !== referrer.origin + '/') return null
+ }
+ return { ...event, url: url.origin + url.pathname }
+ })
+ } catch { return }
+
+ function activated(event) {
+ if (event.type === 'auxclick' && event.button !== 1) return
+ const link = event.target.closest?.('a[data-download-platform][data-download-placement]')
+ if (!link || event.defaultPrevented) return
+ const { downloadPlatform: platform, downloadPlacement: placement } = link.dataset
+ try { analytics('event', { name: 'Download', data: { platform, placement } }) } catch {}
+ }
+ root.addEventListener('click', activated, { passive: true })
+ root.addEventListener('auxclick', activated, { passive: true })
+}
if(typeof document!=='undefined'){
const key=platformFor(navigator.userAgent,navigator.userAgentData?.mobile,navigator.maxTouchPoints)
if(key===null){
@@ -83,4 +120,5 @@ if(typeof document!=='undefined'){
})
}
}
+ countDownloadClicks(document, (...args) => window.va?.(...args))
}
diff --git a/site/scripts/download-clicks.test.mjs b/site/scripts/download-clicks.test.mjs
new file mode 100644
index 00000000..7bd0ced0
--- /dev/null
+++ b/site/scripts/download-clicks.test.mjs
@@ -0,0 +1,67 @@
+import assert from 'node:assert/strict'
+import releases from '../content/updates.json' with { type: 'json' }
+import { homePage } from './site-page.mjs'
+import { updatesPage } from './updates.mjs'
+import { countDownloadClicks, platforms, release } from '../public/marketing/downloads.mjs'
+
+function checkPage(html) {
+ const links = []
+ for (const [selector, region] of [
+ ['.site-header', html.match(/<header class="site-header"[^]*?<\/header>/)[0]],
+ ['.hero', html.match(/<section[^>]+class="hero"[^]*?<\/section>/)?.[0] || ''],
+ ['.site-footer', html.match(/<footer[^]*?<\/footer>/)[0]],
+ ['.updates-page', html.match(/<main[^>]+class="updates-page[^]*?<\/main>/)?.[0] || ''],
+ ]) {
+ for (const [, href] of region.matchAll(/<a\b[^>]*?href="([^"]+\/download\/[^"]+)"[^>]*>/g))
+ links.push({ href, region: selector, closest: s => s === selector, dataset: {} })
+ }
+ const installers = [...html.matchAll(/<a\b[^>]*?href="([^"]+\/download\/[^"]+)"[^>]*>/g)]
+ assert.equal(links.length, installers.length)
+ assert(links.length > 0)
+ // On a mobile device each primary download becomes a menu of real installer links.
+ for (const _ of html.matchAll(/<a\b[^>]*\bdata-download(?:=""|\s)/g)) {
+ for (const platform of Object.values(platforms))
+ links.push({ href: release + platform.file, region: '.mobile-download-list', closest: s => s === '.mobile-download-list', dataset: {} })
+ }
+
+ const calls = []
+ let beforeSend
+ const listeners = {}
+ const doc = { referrer: '', querySelectorAll: selector => links.filter(link => selector === `a[href="${link.href}"]`),
+ addEventListener(name, fn, options) { assert(options.passive); listeners[name] = fn } }
+ countDownloadClicks(doc, (type, data) => {
+ if (type === 'beforeSend') beforeSend = data
+ else { assert.equal(type, 'event'); calls.push(data) }
+ })
+ const placements = { '.site-header': 'nav', '.hero': 'hero', '.site-footer': 'footer', '.mobile-download-list': 'mobile chooser', '.updates-page': 'updates' }
+ for (const link of links) {
+ const placement = placements[link.region]
+ const platform = Object.keys(platforms).find(key => link.href === release + platforms[key].file)
+ assert(platform)
+ assert.deepEqual(link.dataset, { downloadPlatform: platform, downloadPlacement: placement })
+ // Enter activates a native anchor with a click whose detail is zero.
+ for (const detail of [0, 1]) {
+ listeners.click({ target: { closest: () => link }, detail })
+ assert.deepEqual(calls.at(-1), { name: 'Download', data: { platform, placement } })
+ }
+ }
+ listeners.click({ target: { closest: () => null } })
+ listeners.click({ target: { closest: () => links[0] }, defaultPrevented: true })
+ assert.equal(calls.length, links.length * 2)
+ listeners.auxclick({ type: 'auxclick', button: 1, target: { closest: () => links[0] } })
+ listeners.auxclick({ type: 'auxclick', button: 2, target: { closest: () => links[0] } })
+ assert.equal(calls.length, links.length * 2 + 1)
+ const event = { type: 'event', url: 'https://yogurt.so/updates?from=test#release', payload: calls[0] }
+ assert.equal(beforeSend(event).url, 'https://yogurt.so/updates')
+ doc.referrer = 'https://example.org/?private=1'
+ assert.equal(beforeSend(event), null)
+ const pageview = { type: 'pageview', url: event.url }
+ assert.equal(beforeSend(pageview), pageview)
+ assert.match(html, /<meta name="referrer" content="strict-origin"/)
+ countDownloadClicks(doc, () => { throw Error('blocked') })
+ countDownloadClicks(doc, type => { if (type === 'event') throw Error('blocked') })
+ assert.doesNotThrow(() => listeners.click({ target: { closest: () => links[0] } }))
+}
+checkPage(homePage())
+checkPage(updatesPage(releases))
+console.log('Installer anchors, mobile choices, keyboard activation, event privacy and blocked analytics passed.')