Repository navigation
feat: count leads from the join and apply buttons - #100
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
join_community_click/links.platform,link_text,link_url,link_domain,placement,page_pathapply_program_clickprogram(when a program was chosen),link_text,link_url,link_domain,placement,page_pathapplication_submittedprogram,project_id,page_pathregistration_submittedprogram,role,page_pathplacementisheader,footer, or the id of the section the button sits in (the hero istop).How it works
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 carrydata-lead="apply_program".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_clickwithprogramfilled in. Filter onprogramto count choices rather than opens.Checked
Local production build, headless Chrome, phone and desktop sizes: hero, header menu, footer,
/community, a WhatsApp tile on/linksand 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.