diff --git a/src/BuildingCoolingSystem.js b/src/BuildingCoolingSystem.js index 31a507be46f6bfdd6dbad285069feaeec54c0a59..fd536e43d357d1474ae979ef89bf17fea10e132e 100644 --- a/src/BuildingCoolingSystem.js +++ b/src/BuildingCoolingSystem.js @@ -1,6 +1,7 @@ import React from "react"; import { Row, Col, Button, Label, Input, UncontrolledTooltip } from 'reactstrap'; import './index.css'; +import ReactGA from 'react-ga'; export default class BuildingCoolingSystem extends React.Component { constructor(props) { @@ -9,15 +10,15 @@ export default class BuildingCoolingSystem extends React.Component { answer: this.props.answer, }; this.names = [ - 'Window A/C units', - 'PTAC units', - 'Rooftop air conditioning units', - 'Central chiller plant and fan coil units', - 'Mini split heat pump systems', - 'I don\'t have a cooling system', - 'VRF', - 'Other', - 'I\'m not sure', + 'Window A/C units', + 'PTAC units', + 'Rooftop air conditioning units', + 'Central chiller plant and fan coil units', + 'Mini split heat pump systems', + 'I don\'t have a cooling system', + 'VRF', + 'Other', + 'I\'m not sure', ]; this.colId = [ 'WindowUnits', @@ -32,11 +33,24 @@ export default class BuildingCoolingSystem extends React.Component { ]; } + componentDidMount () { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.pageview('/building-cooling-system'); + } + } + prevQuestion = () => { this.props.prevQuestion('buildingCoolingSystem'); } nextQuestion = () => { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.event({ + category: "Intake Survey General", + action: "Clicked continue button", + label: "building-cooling-system" + }); + } this.props.setBuildingCoolingSystem(this.state.answer); this.props.nextQuestion( 'buildingCoolingSystem', @@ -46,6 +60,13 @@ export default class BuildingCoolingSystem extends React.Component { } chooseAnswer = (answer) => { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.event({ + category: "Intake Survey General", + action: "Chose building cooling system", + label: "building-cooling-system" + }); + } this.setState({ answer }); } diff --git a/src/BuildingFutureImprovement.js b/src/BuildingFutureImprovement.js index d234b7a385c3ae8ca26bc35beb97ed534d9f4c64..4abb1a012bf495ce2135a982337409dea55e46e3 100644 --- a/src/BuildingFutureImprovement.js +++ b/src/BuildingFutureImprovement.js @@ -1,6 +1,7 @@ import React from "react"; import { Row, Col, Button, Input } from 'reactstrap'; import './index.css'; +import ReactGA from 'react-ga'; export default class BuildingFutureImprovement extends React.Component { constructor(props) { @@ -74,11 +75,24 @@ export default class BuildingFutureImprovement extends React.Component { }; } + componentDidMount () { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.pageview('/building-future-improvements'); + } + } + prevQuestion = () => { this.props.prevQuestion('buildingFutureImprovement'); } nextQuestion = () => { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.event({ + category: "Intake Survey General", + action: "Clicked continue button", + label: "building-future-improvements" + }); + } const answerIds = this.getAnswerIds(); this.props.nextQuestion( 'buildingFutureImprovement', diff --git a/src/BuildingHeatingSystem.js b/src/BuildingHeatingSystem.js index cb7eca0a01eeefc43ef3dfb2ccc57cbe51f63ed8..7699aaf9e129954e5834990443368647949d9f61 100644 --- a/src/BuildingHeatingSystem.js +++ b/src/BuildingHeatingSystem.js @@ -1,6 +1,7 @@ import React from "react"; import { Row, Col, Button, Label, Input } from 'reactstrap'; import './index.css'; +import ReactGA from 'react-ga'; export default class BuildingHeatingSystem extends React.Component { constructor(props) { @@ -20,11 +21,24 @@ export default class BuildingHeatingSystem extends React.Component { ]; } + componentDidMount () { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.pageview('/building-heating-system'); + } + } + prevQuestion = () => { this.props.prevQuestion('buildingHeatingSystem'); } nextQuestion = () => { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.event({ + category: "Intake Survey General", + action: "Clicked continue button", + label: "building-heating-system" + }); + } this.props.setBuildingHeatingSystem(this.state.answer); this.props.nextQuestion( 'buildingHeatingSystem', @@ -34,6 +48,13 @@ export default class BuildingHeatingSystem extends React.Component { } chooseAnswer = (answer) => { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.event({ + category: "Intake Survey General", + action: "Chose building heating system", + label: "building-heating-system" + }); + } this.setState({ answer }); } diff --git a/src/BuildingNeeds.js b/src/BuildingNeeds.js index e8cf220e72d7843ebdff6c8ad88f6a6c0f22af99..a3d776a85c7fa8695e7c6444767b3532fe58fc15 100644 --- a/src/BuildingNeeds.js +++ b/src/BuildingNeeds.js @@ -1,104 +1,118 @@ import React from "react"; import { Row, Col, Button, Label, Input} from 'reactstrap'; import './index.css'; +import ReactGA from 'react-ga'; export default class BuildingNeeds extends React.Component { - constructor(props) { - super(props); - this.state = { - answerIds: this.props.answer, - }; - this.names = { - GainGeneralEducation: 'Gain general education on energy efficiency', - LowerUtilityBills: 'Lower utility bills', - ResolveHeatingIssues: 'Resolve heating issues', - ResolveCoolingIssues: 'Resolve cooling issues', - ImproveOccupantComfort: 'Improve occupant comfort', - SubstantialBuildingRenovations: 'Substantial building renovations', - HelpFindingContractors: 'Help finding contractors', - AdviceOnEnergyWaterEfficiency: 'Help finding advice on energy and water efficiency', - HelpFinancingEnergyProject: 'Help with financing an energy project', - other: 'Other' - } - } + constructor(props) { + super(props); + this.state = { + answerIds: this.props.answer, + }; + this.names = { + GainGeneralEducation: 'Gain general education on energy efficiency', + LowerUtilityBills: 'Lower utility bills', + ResolveHeatingIssues: 'Resolve heating issues', + ResolveCoolingIssues: 'Resolve cooling issues', + ImproveOccupantComfort: 'Improve occupant comfort', + SubstantialBuildingRenovations: 'Substantial building renovations', + HelpFindingContractors: 'Help finding contractors', + AdviceOnEnergyWaterEfficiency: 'Help finding advice on energy and water efficiency', + HelpFinancingEnergyProject: 'Help with financing an energy project', + other: 'Other' + } + } - prevQuestion = () => { - this.props.prevQuestion('buildingNeeds'); + componentDidMount () { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.pageview('/building-needs'); } + } + + prevQuestion = () => { + this.props.prevQuestion('buildingNeeds'); + } - nextQuestion = () => { - this.props.nextQuestion( - 'buildingNeeds', - this.state.answerIds.map(answerId => this.names[this.props.answers[answerId]]), - this.state.answerIds, - ); + nextQuestion = () => { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.event({ + category: "Intake Survey General", + action: "Clicked continue button", + label: "building-needs" + }); } + this.props.nextQuestion( + 'buildingNeeds', + this.state.answerIds.map(answerId => this.names[this.props.answers[answerId]]), + this.state.answerIds, + ); + } - chooseAnswer = (answerId) => { - let answerIds = this.state.answerIds - if (answerIds.includes(answerId)) { - answerIds = answerIds.filter(id => id !== answerId); - } else { - answerIds.push(answerId); - } - this.setState({ answerIds }); + chooseAnswer = (answerId) => { + let answerIds = this.state.answerIds + if (answerIds.includes(answerId)) { + answerIds = answerIds.filter(id => id !== answerId); + } else { + answerIds.push(answerId); } + this.setState({ answerIds }); + } - render() { - const content = ( -
-
- What are your current building needs? -
-
- Check all that apply -
- { - this.props.answerIds.map(answerId => { - const answerName = this.props.answers[answerId]; - return ( -
- - - - - -
- ); - }) - } + render() { + const content = ( +
+
+ What are your current building needs? +
+
+ Check all that apply +
+ { + this.props.answerIds.map(answerId => { + const answerName = this.props.answers[answerId]; + return ( +
+ + + + + +
+ ); + }) + } - - - - {'<'} Back - - - - - - -
- ); + + + + {'<'} Back + + + + + + +
+ ); - return ( -
- {content} -
- ); - } - } + return ( +
+ {content} +
+ ); + } +} diff --git a/src/BuildingOperatingChallenges.js b/src/BuildingOperatingChallenges.js index b174e6aa70950ec342695790d322ae581d2d02a3..7963ab739dcc730e842586c333065fde32a3376b 100644 --- a/src/BuildingOperatingChallenges.js +++ b/src/BuildingOperatingChallenges.js @@ -1,107 +1,121 @@ import React from "react"; import { Row, Col, Button, Label, Input} from 'reactstrap'; import './index.css'; +import ReactGA from 'react-ga'; export default class BuildingOperatingChallenges extends React.Component { - constructor(props) { - super(props); - this.state = { - answerIds: this.props.answer, - }; - this.names = { - NotEnoughResources: 'Not enough resources (time/staff) to manage the building', - EquipmentBreaksDown: 'Equipment breaks down and/or needs maintenance frequently', - HighUtilityBilOil: 'High utility bill - oil', - HighUtilityBilNaturalGas: 'High utility bill - natural gas', - HighUtilityBilElectricity: 'High utility bill - electricity', - HighUtilityBillWater: 'High utility bill - water', - PoorInsulation: 'The building has poor insulation', - TooCold: 'The building is too cold', - TooDrafty: 'The building is too drafty', - TooHot: 'The building is too hot', - NotEnoughDomesticHotWater: 'The building doesn’t get enough domestic hot water', - BuildingViolations: 'Building violations', - Other: 'Other' - } + constructor(props) { + super(props); + this.state = { + answerIds: this.props.answer, + }; + this.names = { + NotEnoughResources: 'Not enough resources (time/staff) to manage the building', + EquipmentBreaksDown: 'Equipment breaks down and/or needs maintenance frequently', + HighUtilityBilOil: 'High utility bill - oil', + HighUtilityBilNaturalGas: 'High utility bill - natural gas', + HighUtilityBilElectricity: 'High utility bill - electricity', + HighUtilityBillWater: 'High utility bill - water', + PoorInsulation: 'The building has poor insulation', + TooCold: 'The building is too cold', + TooDrafty: 'The building is too drafty', + TooHot: 'The building is too hot', + NotEnoughDomesticHotWater: 'The building doesn’t get enough domestic hot water', + BuildingViolations: 'Building violations', + Other: 'Other' } + } - prevQuestion = () => { - this.props.prevQuestion('buildingOperatingChallenges'); + componentDidMount () { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.pageview('/building-operating-challenges'); } + } - nextQuestion = () => { - this.props.nextQuestion( - 'buildingOperatingChallenges', - this.state.answerIds.map(answerId => this.names[this.props.answers[answerId]]), - this.state.answerIds, - ); - } + prevQuestion = () => { + this.props.prevQuestion('buildingOperatingChallenges'); + } - chooseAnswer = (answerId) => { - let answerIds = this.state.answerIds - if (answerIds.includes(answerId)) { - answerIds = answerIds.filter(id => id !== answerId); - } else { - answerIds.push(answerId); - } - this.setState({ answerIds }); + nextQuestion = () => { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.event({ + category: "Intake Survey General", + action: "Clicked continue button", + label: "building-operating-challenges" + }); } + this.props.nextQuestion( + 'buildingOperatingChallenges', + this.state.answerIds.map(answerId => this.names[this.props.answers[answerId]]), + this.state.answerIds, + ); + } + + chooseAnswer = (answerId) => { + let answerIds = this.state.answerIds + if (answerIds.includes(answerId)) { + answerIds = answerIds.filter(id => id !== answerId); + } else { + answerIds.push(answerId); + } + this.setState({ answerIds }); + } - render() { - const content = ( -
-
- What are your biggest building operating challenges? -
-
- Check all that apply -
- { - this.props.answerIds.map(answerId => { - const answerName = this.props.answers[answerId]; - return ( -
- - - - - -
- ); - }) - } + render() { + const content = ( +
+
+ What are your biggest building operating challenges? +
+
+ Check all that apply +
+ { + this.props.answerIds.map(answerId => { + const answerName = this.props.answers[answerId]; + return ( +
+ + + + + +
+ ); + }) + } - - - - {'<'} Back - - - - - - -
- ); + + + + {'<'} Back + + + + + + +
+ ); - return ( -
- {content} -
- ); - } - } + return ( +
+ {content} +
+ ); + } +} diff --git a/src/BuildingPastImprovement.js b/src/BuildingPastImprovement.js index 0494f8d810bf27fda55655abf9e51f05a45b3b96..bba1b6d2f62daaf1737baafb9e25bd36e895b0ab 100644 --- a/src/BuildingPastImprovement.js +++ b/src/BuildingPastImprovement.js @@ -1,6 +1,7 @@ import React from "react"; import { Row, Col, Button, Input } from 'reactstrap'; import './index.css'; +import ReactGA from 'react-ga'; export default class BuildingPastImprovement extends React.Component { constructor(props) { @@ -74,11 +75,24 @@ export default class BuildingPastImprovement extends React.Component { }; } + componentDidMount () { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.pageview('/building-past-improvements'); + } + } + prevQuestion = () => { this.props.prevQuestion('buildingPastImprovement'); } nextQuestion = () => { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.event({ + category: "Intake Survey General", + action: "Clicked continue button", + label: "building-past-improvements" + }); + } const answerIds = this.getAnswerIds(); this.props.nextQuestion( 'buildingPastImprovement', diff --git a/src/BuildingTypeSubType.js b/src/BuildingTypeSubType.js index 25f0410a64ba59ab6db5d38063ea10f6de46ad05..a64b5ccf29fcb60eed30f0add554558ecaea85cb 100644 --- a/src/BuildingTypeSubType.js +++ b/src/BuildingTypeSubType.js @@ -1,6 +1,7 @@ import React from "react"; import { Row, Col, Button, Label, Input, UncontrolledTooltip } from 'reactstrap'; import './index.css'; +import ReactGA from 'react-ga'; export default class BuildingTypeSubType extends React.Component { constructor(props) { @@ -50,6 +51,12 @@ export default class BuildingTypeSubType extends React.Component { } } + componentDidMount () { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.pageview('/building-type-subtype'); + } + } + prevQuestion = () => { this.props.prevQuestion('buildingTypeSubType'); } @@ -57,6 +64,13 @@ export default class BuildingTypeSubType extends React.Component { nextQuestion = () => { // Other answerId: 33 | Religious answerId: 109 if (this.state.buildingTypeAnswer === 33 || this.state.buildingTypeAnswer === 109) { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.event({ + category: "Intake Survey General", + action: "Clicked continue button", + label: "building-type" + }); + } this.props.nextQuestion( 'buildingTypeSubType', // Answer Id for None is 110 @@ -64,6 +78,13 @@ export default class BuildingTypeSubType extends React.Component { [this.state.buildingTypeAnswer, 110], ); } else { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.event({ + category: "Intake Survey General", + action: "Clicked continue button", + label: "building-type-subtype" + }); + } this.props.nextQuestion( 'buildingTypeSubType', [ @@ -76,6 +97,13 @@ export default class BuildingTypeSubType extends React.Component { } chooseBuildingType = (buildingTypeAnswer) => { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.event({ + category: "Intake Survey General", + action: "Chose building type", + label: "building-type-subtype" + }); + } this.setState({ buildingTypeAnswer, buildingSubTypeAnswer: 0, @@ -89,6 +117,13 @@ export default class BuildingTypeSubType extends React.Component { } chooseBuildingSubType = (buildingSubTypeAnswer) => { + if(process.env.REACT_APP_ENVIRONMENT==='production'){ + ReactGA.event({ + category: "Intake Survey General", + action: "Chose building subtype", + label: "building-type-subtype" + }); + } this.setState({ buildingSubTypeAnswer, continueDisabled: false,