Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,27 @@ the JSON file and hosting/VPS release logs before changing redirects or DNS.
An HTTP failure reported in this tool is an observation from the machine
running it, not definitive proof the origin is offline to every user.
This script makes no publishing, cache-purge, tracking or DNS changes.


## Press-to-store GA4 event unification (2026-11-13)

All five press locales retain the original `press_app_click` event for both
app detail links and Play outbound links. A *real Play click* now additionally
fires the website-wide `download_click` event with allowlisted event data:
store=google_play, location=press, placement=press_kit_card, source=press_kit,
app_slug, app_package, locale. A detail-page click does **not** emit
`download_click`. These represent outbound links **not installs**. No
raw search terms, URLs, private user data or unique identifiers are sent.

Run source tests:

```bash
node --test scripts/test_press_store_events.cjs
python3 -m unittest scripts.test_press_kit -v
```

Following an authorized VPS publish, the existing live smoke now requires
unified press click source on each of the five routes. Use GA4 DebugView to
verify one `press_app_click` per real press link click and one
`download_click` per *Play* click, without counting app detail clicks
as installs. Store acquired users must be verified separately in Play Console.
12 changes: 12 additions & 0 deletions press/es/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
locale:document.documentElement.lang,
placement:'press_kit'
});
// Match the site's shared outbound-store event without counting detail clicks as downloads.
if(a.getAttribute('data-cta')==='store'){
gtag('event','download_click',{
store:'google_play',
location:'press',
placement:'press_kit_card',
app_slug:a.getAttribute('data-app-slug')||'',
app_package:a.getAttribute('data-app-package')||'',
locale:document.documentElement.lang,
source:'press_kit'
});
}
},true);
</script>
</head>
Expand Down
12 changes: 12 additions & 0 deletions press/id/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
locale:document.documentElement.lang,
placement:'press_kit'
});
// Match the site's shared outbound-store event without counting detail clicks as downloads.
if(a.getAttribute('data-cta')==='store'){
gtag('event','download_click',{
store:'google_play',
location:'press',
placement:'press_kit_card',
app_slug:a.getAttribute('data-app-slug')||'',
app_package:a.getAttribute('data-app-package')||'',
locale:document.documentElement.lang,
source:'press_kit'
});
}
},true);
</script>
</head>
Expand Down
12 changes: 12 additions & 0 deletions press/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
locale:document.documentElement.lang,
placement:'press_kit'
});
// Match the site's shared outbound-store event without counting detail clicks as downloads.
if(a.getAttribute('data-cta')==='store'){
gtag('event','download_click',{
store:'google_play',
location:'press',
placement:'press_kit_card',
app_slug:a.getAttribute('data-app-slug')||'',
app_package:a.getAttribute('data-app-package')||'',
locale:document.documentElement.lang,
source:'press_kit'
});
}
},true);
</script>
</head>
Expand Down
12 changes: 12 additions & 0 deletions press/ja/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
locale:document.documentElement.lang,
placement:'press_kit'
});
// Match the site's shared outbound-store event without counting detail clicks as downloads.
if(a.getAttribute('data-cta')==='store'){
gtag('event','download_click',{
store:'google_play',
location:'press',
placement:'press_kit_card',
app_slug:a.getAttribute('data-app-slug')||'',
app_package:a.getAttribute('data-app-package')||'',
locale:document.documentElement.lang,
source:'press_kit'
});
}
},true);
</script>
</head>
Expand Down
12 changes: 12 additions & 0 deletions press/pt-br/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
locale:document.documentElement.lang,
placement:'press_kit'
});
// Match the site's shared outbound-store event without counting detail clicks as downloads.
if(a.getAttribute('data-cta')==='store'){
gtag('event','download_click',{
store:'google_play',
location:'press',
placement:'press_kit_card',
app_slug:a.getAttribute('data-app-slug')||'',
app_package:a.getAttribute('data-app-package')||'',
locale:document.documentElement.lang,
source:'press_kit'
});
}
},true);
</script>
</head>
Expand Down
1 change: 1 addition & 0 deletions scripts/check_app_discovery_live.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ for entry in 'en:press/:en' 'es:press/es/:es' 'pt-br:press/pt-br/:pt-BR' 'ja:pre
grep -Fq "<html lang=\"$language\">" "$tmp/press-$code.html" || { echo "FAIL press $code language not live" >&2; exit 1; }
grep -Fq "https://appdevelopsk.com/$route" "$tmp/press-$code.html" || { echo "FAIL press $code canonical not live" >&2; exit 1; }
grep -Fq 'press_app_click' "$tmp/press-$code.html" || { echo "FAIL press $code app attribution missing" >&2; exit 1; }
grep -Fq "'download_click'" "$tmp/press-$code.html" || { echo "FAIL press $code unified store click attribution missing" >&2; exit 1; }
done
fetch '/support/face-reaction-battle/' 'face-battle.html'
grep -Fq 'data-alternative="instant-judge"' "$tmp/face-battle.html" || { echo 'FAIL unavailable game alternative CTA missing' >&2; exit 1; }
Expand Down
2 changes: 2 additions & 0 deletions scripts/test_press_kit.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def test_all_locales_and_store_destinations(self):
self.assertIn("/apps", anchors)
self.assertNotIn("utm_source=presskit", html, "Internal UTMs would reset acquisition attribution")
self.assertIn("press_app_click", html)
self.assertIn("'download_click'", html)
self.assertIn("source:'press_kit'", html)
self.assertEqual(sum(x.get("data-cta")=="store" for tag,x in doc.attrs if tag=="a"), 5)
self.assertEqual(sum(tag=="a" and attrs.get("lang") in PAGES for tag,attrs in doc.attrs), len(PAGES))

Expand Down
73 changes: 73 additions & 0 deletions scripts/test_press_store_events.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
'use strict';
// Offline browser-style contract for five localized press/creator pages.
// Run: node --test scripts/test_press_store_events.cjs
const test = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const vm = require('node:vm');

const PAGES = {
en: 'press/index.html',
es: 'press/es/index.html',
'pt-BR': 'press/pt-br/index.html',
ja: 'press/ja/index.html',
id: 'press/id/index.html',
};

function exercise(locale, cta) {
const html = fs.readFileSync(path.join(__dirname, '..', PAGES[locale]), 'utf8');
const scripts = [...html.matchAll(/<script(?:[^>]*)>([\s\S]*?)<\/script>/g)].map(m => m[1]);
const handlers = scripts.filter(s => s.includes("'press_app_click'"));
assert.equal(handlers.length, 1, 'one press click handler per locale');
let onClick = null;
const document = {
documentElement: { lang: locale },
addEventListener(event, callback, capture) {
assert.equal(event, 'click');
assert.equal(capture, true);
onClick = callback;
},
};
const context = { document, Date };
context.window = context;
vm.runInNewContext(handlers[0], context);
assert.equal(typeof onClick, 'function');
const values = {
'data-app-slug': 'blur',
'data-app-package': 'com.blurapp.blur_app',
'data-cta': cta,
};
const anchor = { getAttribute: key => values[key] ?? null };
onClick({ target: { closest: selector => {
assert.equal(selector, 'a[data-cta]');
return anchor;
} } });
return context.dataLayer
.filter(row => row[0] === 'event')
.map(row => ({ name: row[1], payload: JSON.parse(JSON.stringify(row[2])) }));
}

for (const locale of Object.keys(PAGES)) {
test(locale + ': store click yields press event plus one unified outbound event', () => {
const events = exercise(locale, 'store');
assert.deepEqual(events.map(x => x.name), ['press_app_click', 'download_click']);
assert.equal(events[0].payload.destination, 'store');
assert.equal(events[0].payload.locale, locale);
assert.equal(events[1].payload.store, 'google_play');
assert.equal(events[1].payload.location, 'press');
assert.equal(events[1].payload.placement, 'press_kit_card');
assert.equal(events[1].payload.source, 'press_kit');
assert.equal(events[1].payload.locale, locale);
assert.equal(events[1].payload.app_slug, 'blur');
assert.equal(events[1].payload.app_package, 'com.blurapp.blur_app');
assert.equal(JSON.stringify(events).includes('link_url'), false);
assert.equal(JSON.stringify(events).includes('query'), false);
});

test(locale + ': app detail click never fires a Play store event', () => {
const events = exercise(locale, 'details');
assert.deepEqual(events.map(x => x.name), ['press_app_click']);
assert.equal(events[0].payload.destination, 'details');
});
}
Loading