Skip to content

Commit

Permalink
Merge pull request #1623 from Automattic/update/help-stats
Browse files Browse the repository at this point in the history
Help: Begin recording a few stats pertaining to the help section.
  • Loading branch information
dllh committed Dec 16, 2015
2 parents 54427f4 + 99bbb16 commit 5514065
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
18 changes: 13 additions & 5 deletions client/me/help/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,31 @@ var ReactDom = require( 'react-dom' ),
/**
* Internal dependencies
*/
var i18n = require( 'lib/mixins/i18n' ),
var analytics = require( 'analytics' ),
i18n = require( 'lib/mixins/i18n' ),
route = require( 'lib/route' ),
titleActions = require( 'lib/screen-title/actions' );

module.exports = {
help: function() {
var Help = require( './main' );
help: function( context ) {
var Help = require( './main' ),
basePath = route.sectionify( context.path );

titleActions.setTitle( i18n.translate( 'Help', { textOnly: true } ) );

analytics.pageView.record( basePath, 'Help' );

ReactDom.render(
React.createElement( Help ),
document.getElementById( 'primary' )
);
},

contact: function() {
var ContactComponent = require( './help-contact' );
contact: function( context ) {
var ContactComponent = require( './help-contact' ),
basePath = route.sectionify( context.path );

analytics.pageView.record( basePath, 'Help > Contact' );

ReactDom.render(
<ContactComponent />,
Expand Down
18 changes: 18 additions & 0 deletions client/me/help/help-contact/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import HeaderCake from 'components/header-cake';
import wpcomLib from 'lib/wp';
import notices from 'notices';
import siteList from 'lib/sites-list';
import analytics from 'analytics';

/**
* Module variables
Expand Down Expand Up @@ -96,6 +97,8 @@ module.exports = React.createClass( {

notifications.forEach( olarkActions.sendNotificationToOperator );

analytics.tracks.recordEvent( 'calypso_help_live_chat_begin' );

this.sendMessageToOperator( message );
},

Expand Down Expand Up @@ -130,6 +133,9 @@ module.exports = React.createClass( {
'one of our Happiness Engineers shortly.' )
}
} );

analytics.tracks.recordEvent( 'calypso_help_contact_submit', { ticket_type: 'kayako' } );

} );
},

Expand Down Expand Up @@ -162,6 +168,8 @@ module.exports = React.createClass( {
)
}
} );

analytics.tracks.recordEvent( 'calypso_help_contact_submit', { ticket_type: 'forum' } );
} );
},

Expand Down Expand Up @@ -203,6 +211,16 @@ module.exports = React.createClass( {
},

onOperatorsAway: function() {
const { isOlarkReady, isUserEligible, details } = this.state.olark;
const showChatVariation = isUserEligible && details.isOperatorAvailable;
const showKayakoVariation = ! showChatVariation && ( details.isConversing || isUserEligible );
const showForumsVariation = ! ( showChatVariation || showKayakoVariation );

if ( ! details.isConversing ) {
analytics.tracks.recordEvent( 'calypso_help_offline_form_display', {
form_type: showKayakoVariation ? 'kayako' : 'forum'
} );
}
this.showOperatorAvailabilityNotice( false );
},

Expand Down
2 changes: 2 additions & 0 deletions client/me/help/help-search/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import HelpResults from 'me/help/help-results';
import NoResults from 'my-sites/no-results';
import SearchCard from 'components/search-card';
import CompactCard from 'components/card/compact';
import analytics from 'analytics';

module.exports = React.createClass( {
displayName: 'HelpSearch',
Expand Down Expand Up @@ -40,6 +41,7 @@ module.exports = React.createClass( {

onSearch: function( searchQuery ) {
this.setState( { helpLinks: [], searchQuery: searchQuery } );
analytics.tracks.recordEvent( 'calypso_help_search', { query: searchQuery } );
HelpSearchActions.fetch( searchQuery );
},

Expand Down

0 comments on commit 5514065

Please sign in to comment.