Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gtag#1034 #1067

Merged
merged 4 commits into from
Nov 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion common/components/controllers/CorporateHackathonController.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ const tabOptions: Dictionary<string> = {
sponsorship: "tab-sponsorship",
};

// for now we are trying to test this with a one file change. In the future we should handle this when and where the GOOGLE PROPERTY ID is set
// safeGtag needs to return true because event handlers need to return true for the event to keep propogating
//
const safeGtag=(...args)=>(window.gtag && gtag(...args),true)

class CorporateHackathonController extends React.PureComponent<{||}, State> {
constructor(props) {
super(props);
Expand Down Expand Up @@ -112,7 +117,8 @@ class CorporateHackathonController extends React.PureComponent<{||}, State> {
return (
<React.Fragment>
<div className="corporate-tab-section">
<Tabs defaultActiveKey={this.state.defaultTab} id="corporate-tabs">
<Tabs defaultActiveKey={this.state.defaultTab} id="corporate-tabs"
onSelect={tab_option=>safeGtag('event',tab_option)}>
<Tab
eventKey={tabOptions.hackathon}
title="Host a Tech-for-Good Hackathon"
Expand Down Expand Up @@ -194,6 +200,7 @@ class CorporateHackathonController extends React.PureComponent<{||}, State> {
variant="primary"
href="#contact-hackathon"
className="corporate-block-button"
onClick={e=>safeGtag('event','contact-hackathon')}
>
Get Started
</Button>
Expand Down Expand Up @@ -333,6 +340,7 @@ class CorporateHackathonController extends React.PureComponent<{||}, State> {
variant="primary"
href="#contact-sponsor"
className="corporate-block-button"
onClick={e=>safeGtag('event','contact-sponsor')}
>
Get Started
</Button>
Expand Down Expand Up @@ -443,6 +451,7 @@ class CorporateHackathonController extends React.PureComponent<{||}, State> {
href={cdn.document(
"2023+DemocracyLab+Corporate+Hackathon+Prospectus.pdf"
)}
onClick={e=>safeGtag('event','HackathonProspectus')}
>
Corporate Tech-for-Good Hackathons PDF{" "}
<i className={Glyph(GlyphStyles.PDF, GlyphSizes.X1)}></i>
Expand All @@ -455,6 +464,7 @@ class CorporateHackathonController extends React.PureComponent<{||}, State> {
href={cdn.document(
"2023+DemocracyLab+Sponsorship+Prospectus.pdf"
)}
onClick={e=>safeGtag('event','SponsorProspectus')}
>
Sponsor Prospectus PDF{" "}
<i className={Glyph(GlyphStyles.PDF, GlyphSizes.X1)}></i>
Expand Down