Skip to content

feat: count leads from the join and apply buttons - #100

Merged
ZeeshanAdilButt merged 2 commits into
mainfrom
feat/lead-events
Nov 12, 2026
Merged

ZeeshanAdilButt merged 2 commits into
mainfrom
feat/lead-events

Conversation

@ZeeshanAdilButt

Copy link
Copy Markdown
Member

Why

Analytics only counted page views, so there was no way to tell whether the site brings in leads. This sends named events to the Google Analytics tag the site already loads. No new script.

Events

Event When Details sent
join_community_click A click on any link to a community group: Discord, WhatsApp, a LinkedIn or Facebook group. Covers "Join the community", "Join on Discord", "Join Discord" and the group tiles on /links. platform, link_text, link_url, link_domain, placement, page_path
apply_program_click A click on any button that starts with "Apply" ("Apply to a program", "Apply now"), or on a program in an "Apply to a program" list. program (when a program was chosen), link_text, link_url, link_domain, placement, page_path
application_submitted A DSOC application form was accepted by the server. program, project_id, page_path
registration_submitted A DSOC mentee or mentor registration was accepted by the server. program, role, page_path

placement is header, footer, or the id of the section the button sits in (the hero is top).

How it works

  • One click listener on the document (components/lead-tracker.tsx) recognises the links by where they lead and what they say, so every page and every future button is covered without touching each button. The programs in the two "Apply to a program" lists are named by program, so those links carry data-lead="apply_program".
  • The analytics tag loads late on purpose (after the page is idle). A click before that is kept in a short queue and sent when the tag starts.

What the site cannot see

The community groups (Discord, WhatsApp) and the ambassador application (a Google Form) live on other sites, so for those the click is the last thing this site can observe. Only the DSOC forms are on this site, and they report a real submit.

"Apply to a program" in the hero and footer scrolls to the list of programs; choosing a program there sends a second apply_program_click with program filled in. Filter on program to count choices rather than opens.

Checked

Local production build, headless Chrome, phone and desktop sizes: hero, header menu, footer, /community, a WhatsApp tile on /links and the ambassador form each send the expected event; a click made before the tag has loaded is delivered once it loads; ordinary links send nothing; no page errors.

Analytics only counted page views, so there was no way to see whether the
site brings in leads. Two named events now go to the Google Analytics tag the
site already loads:

- join_community_click: any link to a community group (Discord, WhatsApp, a
  LinkedIn or Facebook group)
- apply_program_click: any button that starts with Apply, or a program in an
  Apply to a program list

Each carries the button's text, where it leads, the page and where on the page
it sits. One listener on the document covers every page and future buttons.
The tag loads late on purpose, so a click before then waits in a short queue
and is sent when the tag starts.
A completed form is a truer lead than a click. The three forms that live on
this site send application_submitted or registration_submitted once the server
has accepted them.
@ZeeshanAdilButt
ZeeshanAdilButt merged commit f23a3cf into main Nov 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant