Skip to content

Commit

Permalink
Track stats for automatically converted blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
nylen committed Aug 4, 2017
1 parent ec4fc59 commit a54a6f1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions blocks/api/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
import { parse as hpqParse } from 'hpq';
import { pickBy } from 'lodash';

/**
* WordPress dependencies
*/
import { bumpStat } from '@wordpress/utils';

/**
* Internal dependencies
*/
Expand Down Expand Up @@ -75,6 +80,7 @@ export function createBlockWithFallback( name, rawContent, attributes ) {
// Convert 'core/text' blocks in existing content to the new
// 'core/paragraph'.
if ( name === 'core/text' ) {
bumpStat( 'block_auto_convert', 'core-text-to-paragraph' );
name = 'core/paragraph';
}

Expand Down
11 changes: 11 additions & 0 deletions test/setup-globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,14 @@ global.wp = global.wp || {};
global.wp.a11y = {
speak: () => {},
};

global.window.getUserSetting = settingName => {
switch ( settingName ) {
case 'gutenberg_tracking':
return 'on';
default:
throw new Error(
'Unrecognized user setting requested: ' + settingName
);
}
};

0 comments on commit a54a6f1

Please sign in to comment.