-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editor Stats - Poor fidelity with blocks_replaced
property in block events.
#53634
Editor Stats - Poor fidelity with blocks_replaced
property in block events.
#53634
Comments
I can check this as I'm in amongst the tracking code. Have no idea how to access Tracks or where this data goes so any private links to that would be much appreciated. |
@jordesign We are listening for the dispatch of This is handled by a custom tracking handler... wp-calypso/apps/wpcom-block-editor/src/wpcom/features/tracking.js Lines 465 to 472 in 280d00d
...which ignores various sync'd block types: wp-calypso/apps/wpcom-block-editor/src/wpcom/features/tracking.js Lines 491 to 503 in 280d00d
Reviewing the original concerns:
This is still the case. We are listening on
✅ Columns uses it in setup state ✅ Navigation uses it although not in any setup state as that's no longer in the UI ✅ Query uses it in setup state We can't make changes to WP Core at the moment so that's not going to change any time soon and we have no way of differentiating the
This is already handled by the exception I mentioned above. So ultimately we can fix 1 out of the 3 issues mentioned. I'm not sure how critical it is to have the level of fidelity requested here but we could work on updating the Page Layout selector if it's sufficiently important. |
Thanks for looking into it @getdave - to be honest I don't know what we ideally need here. It's been 3 years since the ask - so I'd hazard that fixing one of those things is good for now. |
Hi @jordesign thanks for looping me in and @getdave for investigating. If it's a relatively trivial fix, then even fixing 1 out of the 3 issues mentioned above is great. But in terms of upcoming analyses and data needs, I don't think the |
@getdave I'd agree that if it is trivial enough to roll out that fix - let's do so and then close the issue. |
Ok I'll look into the above Issue specifically and post an update (cc @scruffian). |
Our custom implementation is here Initial research shows that Gutenberg Core does not rely on |
@jordesign I wonder will this UI being going away as Core has removed it in favour of the Patterns sidebar WordPress/gutenberg#66836? cc @scruffian |
@jordesign @kurt213 I looked into this some more and realised that depsite the fact that we are using wp-calypso/apps/wpcom-block-editor/src/wpcom/features/tracking.js Lines 532 to 534 in 7c8a2f2
We also pass some more useful info along with the event including:
Moving to As the original issue seems to be worried about firing the |
Sounds like we can let this one be closed then. Thanks folks. |
The core data action
replaceInnerBlocks
is being tracked, and for each block being added via this action we trigger a block inserted event with theblocks_replaced
property marked astrue
. At first glance this seems reasonable, butreplaceInnerBlocks
is used in a handful of areas where there may not actually be any blocks to replace.For example:
replaceInnerBlocks
to add a layout pattern to the post editor. However, this is currently only accessible when we create a new post and there are no blocks to replace. Thereforeblocks_replaced: true
is kind of a misleading stat in this case. Now that the page layout selector is no longer available from the sidebar (therefore not usable after there are blocks in the editor), we could probably update this component to useinsertBlocks
instead, however this is not the only conflict.replaceInnerBlocks
in setup states for blocks like thecore/query
,core/columns
, andcore/navigation
. Meaning that when someone choses a setup option for these blocks, the blocks corresponding to that setup pattern are inserted viareplaceInnerBlocks
which again triggers block inserted events withblocks_replaced: true
even though no blocks are actually being replaced.replaceInnerBlocks
to sync blocks in inner blocks controllers for blocks such ascore/block
(the reusable block) andcore/template-part
. Meaning a spam of block inserted events withblocks_replaced: true
can happen whenever we load the editor containing one of these blocks, undo/redo effecting contents of these blocks, or edit when duplicates of these blocks are on the page. For now, we can avoid this spam of false events by conditionally ignoringreplaceInnerBlocks
when the parent is a template part or reusable block (Block Editor Tracking: Fix innerBlocksReplace tracking #53501).Im not entirely sure the best way to address this. If we remove tracking for
replaceInnerBlocks
entirely then we will lose block inserted events where we would expect them to show up (such as the setup states noted in example 2 as well as the page layout selector if we don't convert it to use insertBlocks), but in keeping this tracking we don't really have a good way to determine if theblocks_replaced
property being added to the insert blocks events is actually true or not.cc @david-szabo97 @getdave @marekhrabe @retrofox @kurt213
The text was updated successfully, but these errors were encountered: