diff --git a/index.html b/index.html
index 70b2997c..ff4babb0 100644
--- a/index.html
+++ b/index.html
@@ -63,7 +63,7 @@
} else if (a.classList.contains('discovery-link')) {
gtag('event', 'discovery_nav_click', { guide: a.getAttribute('data-guide') || 'catalog', origin: 'homepage' });
} else if (a.classList.contains('app-card')) {
- gtag('event', 'app_view', { app: href.replace(/^support\//, '').replace(/\/$/, '') });
+ gtag('event', 'app_detail_click', { app_slug: href.replace(/^support\//, '').replace(/\/$/, ''), placement: 'homepage_card' });
} else if (/pickly\.blog|toolify365\.com|fxea365\.com/.test(href)) {
gtag('event', 'crosspromo_click', { link_url: href });
}
diff --git a/scripts/check_growth_live.py b/scripts/check_growth_live.py
index ca1be0c0..4c5b6db5 100644
--- a/scripts/check_growth_live.py
+++ b/scripts/check_growth_live.py
@@ -30,6 +30,9 @@ def check(path, key, valid):
check("/", "current_meta", "SK Apps | Mobile Apps, Games & Everyday Tools" in home)
check("/", "no_stale_store_count", "92 Apps on Google Play" not in home)
check("/", "analytics", "G-5Z588FVC81" in home)
+ check("/", "homepage_card_click_semantics",
+ "gtag('event', 'app_detail_click'" in home and
+ "gtag('event', 'app_view'" not in home)
for slug in FEATURED_SLUGS:
check("/", f"featured_{slug}", f'href="support/{slug}/"' in home)
diff --git a/scripts/test_growth_live.py b/scripts/test_growth_live.py
index fac63f2a..a28fb4b2 100644
--- a/scripts/test_growth_live.py
+++ b/scripts/test_growth_live.py
@@ -7,7 +7,7 @@
def valid_pages():
pages = {path: "" for path in PATHS}
- pages["/"] = "SK Apps | Mobile Apps, Games & Everyday Tools G-5Z588FVC81 " + " ".join(
+ pages["/"] = "SK Apps | Mobile Apps, Games & Everyday Tools G-5Z588FVC81 gtag(\'event\', \'app_detail_click\' " + " ".join(
f'href="support/{slug}/"' for slug in FEATURED_SLUGS)
packages = [f"jp.appdevelopsk.testapp{i}" for i in range(92)]
cards = " ".join(
@@ -119,6 +119,16 @@ def test_missing_live_page_fails(self):
del data["/apps"]
self.assertFalse(inspect(data)["passed"])
+ def test_homepage_click_mislabeled_view_fails(self):
+ data = valid_pages()
+ data["/"] = data["/"].replace("app_detail_click", "app_view")
+ self.assertFalse(inspect(data)["passed"])
+
+ def test_homepage_missing_card_click_event_fails(self):
+ data = valid_pages()
+ data["/"] = data["/"].replace("app_detail_click", "something_else")
+ self.assertFalse(inspect(data)["passed"])
+
def test_stale_homepage_metadata_fails(self):
data = valid_pages()
data["/"] += "92 Apps on Google Play"