Skip to content

Commit

Permalink
📊 Add event tracking for parameter updates
Browse files Browse the repository at this point in the history
  • Loading branch information
acusti committed May 22, 2015
1 parent 9c5f19f commit feb23cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app.jsx
Expand Up @@ -11,6 +11,7 @@ import ReactRouter from 'react-router';
import App from './app/index.js';
// User routes
import routes from './routes.js';
// Helpers
import basePath from './helpers/base-path.js';
import analytics from './helpers/analytics.js';

Expand Down
7 changes: 7 additions & 0 deletions src/components/PrimalMultiplication.jsx
Expand Up @@ -3,6 +3,7 @@ import Parameters from './Parameters.jsx';
import MultiplicationTable from './MultiplicationTable.jsx';
import findPrimes from '../helpers/find-primes.js';
import StateStore from '../helpers/state-store.js';
import analytics from '../helpers/analytics.js';

let componentOffsetTop;

Expand Down Expand Up @@ -32,6 +33,12 @@ class PrimalMultiplication extends React.Component {
primes = this.state.tableProps.primes;
} else {
primes = findPrimes(primesLength);
// Track user interaction
analytics.addEvent('parameter-updates', {
type : 'primes-length',
value : primesLength,
oldValue : this.state.tableProps ? this.state.tableProps.primesLength : '',
});
}
this.setState({
tableProps: {
Expand Down

0 comments on commit feb23cd

Please sign in to comment.