@@ -4,6 +4,7 @@ import React, {PropTypes} from 'react';
4
4
import { connect } from 'react-redux' ;
5
5
import trackEvent from '../../util/trackEvent' ;
6
6
import color from '../../util/color' ;
7
+ import firehoseClient from '@cdo/apps/lib/util/firehose' ;
7
8
8
9
// TODO (elijah): have these constants shared w/dashboard
9
10
const VOICES = {
@@ -88,7 +89,12 @@ class InlineAudio extends React.Component {
88
89
textToSpeechEnabled : PropTypes . bool ,
89
90
src : PropTypes . string ,
90
91
message : PropTypes . string ,
91
- style : PropTypes . object
92
+ style : PropTypes . object ,
93
+
94
+ // Provided by redux
95
+ // To Log TTS usage
96
+ puzzleNumber : PropTypes . number ,
97
+ userId : PropTypes . number
92
98
} ;
93
99
94
100
state = {
@@ -169,6 +175,19 @@ class InlineAudio extends React.Component {
169
175
playAudio ( ) {
170
176
this . getAudioElement ( ) . play ( ) ;
171
177
this . setState ( { playing : true } ) ;
178
+ firehoseClient . putRecord (
179
+ {
180
+ study : 'tts-play' ,
181
+ study_group : 'v1' ,
182
+ event : 'play' ,
183
+ data_string : this . props . src ,
184
+ data_json : JSON . stringify ( {
185
+ userId : this . props . userId ,
186
+ puzzleNumber : this . props . puzzleNumber ,
187
+ src : this . props . src
188
+ } ) ,
189
+ }
190
+ ) ;
172
191
}
173
192
174
193
pauseAudio ( ) {
@@ -221,5 +240,7 @@ export default connect(function propsFromStore(state) {
221
240
assetUrl : state . pageConstants . assetUrl ,
222
241
textToSpeechEnabled : state . pageConstants . textToSpeechEnabled || state . pageConstants . isK1 ,
223
242
locale : state . pageConstants . locale ,
243
+ userId : state . pageConstants . userId ,
244
+ puzzleNumber : state . pageConstants . puzzleNumber
224
245
} ;
225
246
} ) ( StatelessInlineAudio ) ;
0 commit comments