Skip to content

Commit

Permalink
add GA events to Preview
Browse files Browse the repository at this point in the history
  • Loading branch information
adammockor committed Aug 30, 2019
1 parent e45ac7b commit 912b310
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/styleguide/src/components/Preview/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import cx from 'classnames';
import Select from 'react-select';
import styled from 'styled-components';
import chroma from 'chroma-js';
import ReactGA from 'react-ga';

import PreviewTitleBar from './PreviewTitleBar';
import CodeExample from './CodeExample';
Expand Down Expand Up @@ -121,22 +122,43 @@ class Preview extends Component {
this.setState({
isCodeShown: !this.state.isCodeShown,
});

ReactGA.event({
category: 'Preview',
action: 'toggleCode',
});
}

handleToggleInteract() {
this.setState({
showInteract: !this.state.showInteract,
});

ReactGA.event({
category: 'Preview',
action: 'toggleInteract',
});
}

handlePreviewBackground = previewBackground => {
this.setState({ previewBackground });

ReactGA.event({
category: 'Preview',
action: 'changeBackground',
label: previewBackground.label,
});
};

handleToggleFullscreen() {
this.setState({
isFullscreen: !this.state.isFullscreen,
});

ReactGA.event({
category: 'Preview',
action: 'toggleFullscreen',
});
}

return;
Expand Down

0 comments on commit 912b310

Please sign in to comment.