-
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
Block Editor Tracking: Track convert to template part and detach blocks from template part actions #53592
Block Editor Tracking: Track convert to template part and detach blocks from template part actions #53592
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
9f50a6d
to
2bcf92f
Compare
Link to Calypso live: https://calypso.live?image=registry.a8c.com/calypso/app:build-9874 |
bfcb32f
to
b8b5d4a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working great in testing.
I wonder if we should add any extra properties to this event. 🤔
variation_slug
probably makes sense to determine if they are creating/detaching a header, footer, or other in this way.- Im not sure if any information about the blocks being converted or detached might make sense here. Number of blocks? a flattened list of block names? Im not certain but maybe @kurt213 and/or @ianstewart have ideas here?
|
||
registerDelegateEventSubscriber( | ||
'wpcom-block-editor-template-part-detach-blocks', | ||
'before', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting it seems that for this case it doesn't really matter if this is 'before' or 'after', although it seems good to have this flexibility in general! 🎉 Its great that we can add extra handlers when we want, and of course the big thing here is being able to track on capture as well!
b8b5d4a
to
ec5c8b2
Compare
I could see this being useful in the future for design purposes if it could be pulled with a data request. Could be used to design better patterns. |
6d9ca0a
to
6165158
Compare
👍 . I'm not too familiar with all the possible variations for this, but this level of detail would be helpful.
👍 This would be helpful. It wouldn't be something that can easily be analysed in something like Tracks, but as @ianstewart mentioned, a data request, custom SQL query or a transformation pipeline into Looker could make use of this level of granularity. |
Basically just "header", "footer", or "general" at this point in time. |
ec5c8b2
to
340b641
Compare
@kurt213 AFAIK, arrays aren't supported by Tracks. Should join the list of block names using comma (comma separated list) or turn it into a JSON? |
This PR modifies the release build for wpcom-block-editor To test your changes on WordPress.com, run To deploy your changes after merging, see the documentation: PCYsg-l4k-p2 |
This PR modifies the release build for notifications To test your changes on WordPress.com, run To deploy your changes after merging, see the documentation: PCYsg-elI-p2 |
This PR modifies the release build for editing-toolkit To test your changes on WordPress.com, run To deploy your changes after merging, see the documentation: PCYsg-mMA-p2 |
30364fc
to
0123066
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is working well! I think we will needs some tests here or in a follow up?
// We fire the event with and without the block names. We do this to | ||
// make sure the event is tracked all the time. The block names | ||
// might become a string that's too long and as a result it will | ||
// fail because of URL length browser limitations. | ||
tracksRecordEvent( 'wpcom_block_editor_convert_to_template_part', { | ||
variation_slug: record.area, | ||
} ); | ||
tracksRecordEvent( 'wpcom_block_editor_convert_to_template_part', { | ||
variation_slug: record.area, | ||
block_names: getFlattenedBlockNames( convertedParentBlocks ).join( ',' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not in love with the idea of sending two events... but given the slack discussions that seems like it makes sense for now!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... sending two events is a bit gross. But I'm not sure how we could limit the length of the block_names property. Since the URL length will vary based on other properties too.
21e71a2
to
79c9033
Compare
...m-block-editor/src/wpcom/features/tracking/wpcom-block-editor-template-part-detach-blocks.js
Outdated
Show resolved
Hide resolved
f05363f
to
1b869c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionality and tests work great!
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/6157542 Thank you @david-szabo97 for including a screenshot in the description! This is really helpful for our translators. |
() => { | ||
ignoreNextReplaceBlocksAction = true; | ||
} | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this is bleeding into other events that may be triggered by the same selector, as we did not check the conditions here as we did for firing the event.
#54415 should fix
Translation for this Pull Request has now been finished. |
Changes proposed in this Pull Request
replaceBlocks
isn't tracked after "Make template part"NOTE: The #53598 PR is a prerequisite for this PR.
We are firing both events twice. One with
block_names
property and one without it. We do this to ensure the event is tracked all the time. The event fired withblock_names
property will fail if there are way too many blocks involved. URL length of the request becomes too long and the browser fails to deliver it.Testing instructions
wpcom_block_editor_convert_to_template_part
event is fired twice. One withoutblock_names
and one withblock_names
property.replaceBlocks
is triggered, but no events are trackedwpcom_block_editor_template_part_detach_blocks
event is fired twice. One withoutblock_names
and one withblock_names
property.replaceBlocks
is triggered, but no events are tracked (subscriber system utilized here)Related to #53410