feat(website): send a GA4 event on sponsorship email clicks

Mailto clicks on the sponsorship page leave no page view, so the sponsor funnel ended at the sponsorship page and never showed who went on to email. Each click now sends a sponsor_contact event with a short tier value (headline, featured, indie, or general) rather than the link URL, since GA4 caps event parameter values at 100 characters and the Indie Dev mailto href is 101.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Vinta Chen
2026-10-21 09:09:21 +08:00
co-authored by Claude
parent 13e777b299
commit 7e6baa968b
2 changed files with 13 additions and 0 deletions
+7
View File
@@ -399,6 +399,13 @@ document.addEventListener("click", function (e) {
}
});
// Mailto clicks leave no page view, so the sponsor funnel needs its own event
document.addEventListener("click", function (e) {
const link = e.target.closest('a[href^="mailto:sponsorship@"]');
if (!link || typeof gtag !== "function") return;
gtag("event", "sponsor_contact", { tier: link.dataset.tier });
});
if (location.hash) {
const linkedRow = document.getElementById(decodeURIComponent(location.hash.slice(1)));
if (linkedRow && linkedRow.matches("tr.row")) openEntryRow(linkedRow);
+6
View File
@@ -45,6 +45,7 @@
<div class="hero-actions">
<a
href="mailto:sponsorship@awesome-python.com?subject=Awesome%20Python%20Sponsorship"
data-tier="general"
class="hero-action hero-action-primary"
>Email sponsorship@awesome-python.com</a
>
@@ -128,6 +129,7 @@
</ul>
<a
href="mailto:sponsorship@awesome-python.com?subject=Awesome%20Python%20Sponsorship%20-%20Headline%20Tier"
data-tier="headline"
class="tier-cta"
>Email about Headline tier</a
>
@@ -151,6 +153,7 @@
</ul>
<a
href="mailto:sponsorship@awesome-python.com?subject=Awesome%20Python%20Sponsorship%20-%20Featured%20Tier"
data-tier="featured"
class="tier-cta"
>Email about Featured tier</a
>
@@ -180,6 +183,7 @@
</ul>
<a
href="mailto:sponsorship@awesome-python.com?subject=Awesome%20Python%20Sponsorship%20-%20Indie%20Dev%20Tier"
data-tier="indie"
class="tier-cta"
>Email about Indie Dev tier</a
>
@@ -225,6 +229,7 @@
Email
<a
href="mailto:sponsorship@awesome-python.com?subject=Awesome%20Python%20Sponsorship"
data-tier="general"
>sponsorship@awesome-python.com</a
>
with the four items below.
@@ -261,6 +266,7 @@
<div class="sponsorship-cta-row">
<a
href="mailto:sponsorship@awesome-python.com?subject=Awesome%20Python%20Sponsorship"
data-tier="general"
class="hero-action hero-action-primary"
>Email sponsorship@awesome-python.com</a
>