diff --git a/src/containers/BGroup/BGroup.js b/src/containers/BGroup/BGroup.js index 5a0df2ead7ed2f8fcf8003b4e0def97d13d4eb80..211dbeee6984edb6871566d4a546501cb4909f6c 100644 --- a/src/containers/BGroup/BGroup.js +++ b/src/containers/BGroup/BGroup.js @@ -7,6 +7,7 @@ import { Button, Nav, NavItem, NavLink } from 'reactstrap'; import ReactTable from 'react-table'; import 'react-table/react-table.css'; import { Icon } from 'react-fa'; +import ReactGA from 'react-ga'; import ReactTooltip from 'react-tooltip'; import Loading from '../../components/Loading'; import NavBar from '../../components/NavBar'; @@ -615,16 +616,25 @@ export class BGroup extends Component { columns={columns} defaultPageSize={50} ref={(reactTable) => { this.reactTable = reactTable; }} - onFilteredChange={() => { + onFilteredChange={(filter) => { // Create a bounce function so as to not decrease the speed of the filter. clearTimeout(this.updateNumRows); this.updateNumRows = setTimeout( () => { + ReactGA.event({ + category: 'Building Group', + action: 'Filter', + label: filter.reduce((acc, val) => { + return ( + `${acc}, ${val.id}: ${val.value}` + ); + }, `Building Group: ${this.props.bGroup.bGroupDetail.name}, # Results: ${this.reactTable.state.sortedData.length}`), + }); this.setState({ numRows: this.reactTable.state.sortedData.length, }); }, - 100, + 250, ); }} noDataText={this.props.bGroup.bGroupDetailLoading ? 'Loading...' : 'No data'} @@ -732,7 +742,14 @@ export class BGroup extends Component { this.setState({ overviewTab: 'projects' })} + onClick={() => { + this.setState({ overviewTab: 'projects' }); + ReactGA.event({ + category: 'Building Group', + action: 'Click Projects Overview Tab', + label: this.props.bGroup.bGroupDetail.name, + }); + }} > Projects Overview @@ -740,7 +757,14 @@ export class BGroup extends Component { this.setState({ overviewTab: 'buildings' })} + onClick={() => { + this.setState({ overviewTab: 'buildings' }); + ReactGA.event({ + category: 'Building Group', + action: 'Click Buildings Overview Tab', + label: this.props.bGroup.bGroupDetail.name, + }); + }} > Buildings Overview