Skip to content
Snippets Groups Projects
Unverified Commit 62e12b0e authored by Paul Kaplan's avatar Paul Kaplan Committed by GitHub
Browse files

Merge pull request #2682 from paulkaplan/improve-analytics

Improve search and tutorial instrumentation for preview
parents b5821707 c6e67044
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ import Modal from '../../containers/modal.jsx'; ...@@ -9,6 +9,7 @@ import Modal from '../../containers/modal.jsx';
import Divider from '../divider/divider.jsx'; import Divider from '../divider/divider.jsx';
import Filter from '../filter/filter.jsx'; import Filter from '../filter/filter.jsx';
import TagButton from '../../containers/tag-button.jsx'; import TagButton from '../../containers/tag-button.jsx';
import analytics from '../../lib/analytics';
import styles from './library.css'; import styles from './library.css';
...@@ -28,6 +29,7 @@ class LibraryComponent extends React.Component { ...@@ -28,6 +29,7 @@ class LibraryComponent extends React.Component {
super(props); super(props);
bindAll(this, [ bindAll(this, [
'handleBlur', 'handleBlur',
'handleClose',
'handleFilterChange', 'handleFilterChange',
'handleFilterClear', 'handleFilterClear',
'handleFocus', 'handleFocus',
...@@ -56,9 +58,17 @@ class LibraryComponent extends React.Component { ...@@ -56,9 +58,17 @@ class LibraryComponent extends React.Component {
this.handleMouseEnter(id); this.handleMouseEnter(id);
} }
handleSelect (id) { handleSelect (id) {
this.props.onRequestClose(); this.handleClose();
this.props.onItemSelected(this.getFilteredData()[id]); this.props.onItemSelected(this.getFilteredData()[id]);
} }
handleClose () {
analytics.event({
category: 'library',
action: `${this.props.id}: close with search`,
label: this.state.filterQuery || '(empty)'
});
this.props.onRequestClose();
}
handleTagClick (tag) { handleTagClick (tag) {
this.setState({ this.setState({
filterQuery: '', filterQuery: '',
...@@ -111,7 +121,7 @@ class LibraryComponent extends React.Component { ...@@ -111,7 +121,7 @@ class LibraryComponent extends React.Component {
fullScreen fullScreen
contentLabel={this.props.title} contentLabel={this.props.title}
id={this.props.id} id={this.props.id}
onRequestClose={this.props.onRequestClose} onRequestClose={this.handleClose}
> >
{(this.props.filterable || this.props.tags) && ( {(this.props.filterable || this.props.tags) && (
<div className={styles.filterBar}> <div className={styles.filterBar}>
......
...@@ -54,6 +54,7 @@ class TipsLibrary extends React.PureComponent { ...@@ -54,6 +54,7 @@ class TipsLibrary extends React.PureComponent {
<LibraryComponent <LibraryComponent
data={decksLibraryThumbnailData} data={decksLibraryThumbnailData}
filterable={false} filterable={false}
id="tipsLibrary"
title={this.props.intl.formatMessage(messages.tipsLibraryTitle)} title={this.props.intl.formatMessage(messages.tipsLibraryTitle)}
visible={this.props.visible} visible={this.props.visible}
onItemSelected={this.handleItemSelect} onItemSelected={this.handleItemSelect}
......
import analytics from '../lib/analytics';
import decks from '../lib/libraries/decks/index.jsx'; import decks from '../lib/libraries/decks/index.jsx';
const CLOSE_CARDS = 'scratch-gui/cards/CLOSE_CARDS'; const CLOSE_CARDS = 'scratch-gui/cards/CLOSE_CARDS';
...@@ -38,6 +40,11 @@ const reducer = function (state, action) { ...@@ -38,6 +40,11 @@ const reducer = function (state, action) {
}); });
case NEXT_STEP: case NEXT_STEP:
if (state.activeDeckId !== null) { if (state.activeDeckId !== null) {
analytics.event({
category: 'how-to',
action: 'next step',
label: `${state.activeDeckId} - ${state.step}`
});
return Object.assign({}, state, { return Object.assign({}, state, {
step: state.step + 1 step: state.step + 1
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment