Skip to content
Merged
8 changes: 6 additions & 2 deletions support/key-clash/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
if (!a) return;
var href = a.getAttribute('href') || '';
if (/play\.google\.com/.test(href)) {
gtag('event', 'download_click', { store: 'google_play', location: 'support', link_url: href });
gtag('event', 'download_click', { store: 'google_play', location: 'support', placement: a.getAttribute('data-position') || 'details', app_slug: 'key-clash', link_url: href });
}
}, true);
</script>
Expand Down Expand Up @@ -123,10 +123,14 @@ <h2 data-i18n="features">Key Features</h2>
<h2 data-i18n="download">Download</h2>
<p data-i18n="download_desc">Available on Android. Download for free from Google Play and start using today.</p>
<div class="download-btns">
<a href="https://play.google.com/store/apps/details?id=com.keyclash.key_clash&amp;utm_source=appdevelopsk&amp;utm_medium=web&amp;utm_campaign=support_key-clash&amp;referrer=utm_source%3Dappdevelopsk%26utm_medium%3Dweb%26utm_campaign%3Dsupport_key-clash" class="dl-btn dl-btn-play" rel="noopener" target="_blank">Google Play</a>
<a href="https://play.google.com/store/apps/details?id=com.keyclash.key_clash&amp;utm_source=appdevelopsk&amp;utm_medium=web&amp;utm_campaign=support_key-clash&amp;referrer=utm_source%3Dappdevelopsk%26utm_medium%3Dweb%26utm_campaign%3Dsupport_key-clash" class="dl-btn dl-btn-play" data-position="details" rel="noopener" target="_blank">Google Play</a>
</div>
</div>

<div class="card" id="related-games">
<h2>Try another quick game</h2>
<p>If KeyClash is not listed on Google Play in your region, or you prefer trivia, puzzles or image guessing, compare available options in the <a href="/guides/quick-games/" style="color:var(--c1)">short mobile games guide</a> (<a href="/guides/quick-games/ja/" lang="ja" style="color:var(--c1)">日本語</a>).</p>
</div>
<div class="card">
<h2 data-i18n="faq">Frequently Asked Questions</h2>
<ul>
Expand Down
40 changes: 40 additions & 0 deletions tests/keyclash-quick-games-journey.test.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { join } from 'node:path';

const root=process.cwd();
const en=readFileSync(join(root,'guides/quick-games/index.html'),'utf8');
const ja=readFileSync(join(root,'guides/quick-games/ja/index.html'),'utf8');
const support=readFileSync(join(root,'support/key-clash/index.html'),'utf8');

test('unverified Play app is not newly promoted by Quick Games guides', () => {
assert.equal((en.match(/<article class="app">/g)||[]).length,5);
assert.equal((ja.match(/<article class="app">/g)||[]).length,4);
for(const html of [en,ja]){
const s=JSON.parse(html.match(/<script type="application\/ld\+json">([^<]+)<\/script>/)[1]);
assert.equal(s.itemListElement.length,(html.match(/<article class="app">/g)||[]).length);
assert.equal(s.itemListElement.filter(x=>x.url.includes("com.keyclash.key_clash")).length,0);
}
});

test('KeyClash support has a safe alternative path if Play is unavailable',()=>{
assert.match(support,/If KeyClash is not listed on Google Play in your region/);
assert.match(support,/href="\/guides\/quick-games\/"/);
assert.match(support,/href="\/guides\/quick-games\/ja\/"/);
assert.equal((support.match(/id="related-games"/g)||[]).length,1);
});

test('only one store-click event remains and support attribution is classified',()=>{
assert.equal((support.match(/gtag\('event', 'download_click'/g)||[]).length,1);
assert.ok(support.includes("app_slug: 'key-clash'"));
assert.ok(support.includes('data-position="details"'));
assert.ok(support.includes('<link rel="canonical" href="https://appdevelopsk.com/support/key-clash/">'));
});

test('existing bilingual guides retain original canonical and hreflang links',()=>{
assert.ok(en.includes('<link rel="canonical" href="https://appdevelopsk.com/guides/quick-games/">'));
assert.ok(ja.includes('<link rel="canonical" href="https://appdevelopsk.com/guides/quick-games/ja/">'));
assert.ok(en.includes('hreflang="ja" href="https://appdevelopsk.com/guides/quick-games/ja/"'));
assert.ok(ja.includes('hreflang="en" href="https://appdevelopsk.com/guides/quick-games/"'));
});
Loading