-
Notifications
You must be signed in to change notification settings - Fork 804
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
Post list: Add track events for quick links and stats #40935
base: trunk
Are you sure you want to change the base?
Conversation
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! |
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.
Is that something that could be added directly to the Post List package? If the two are closely related, it may be easier to maintain in the future.
If we do it in the package directly, maybe we'd be able to add the tracking to the links without having to rely on JavaScript, fully relying on the Automattic\Jetpack\Tracking
class, that handles enqueuing Tracks as well as managing whether a site has already agreed to our ToS. I haven't dealt with Tracks in PHP in a long time, but I believe it should be enough to add the jptracks
class to a link, and a data-jptracks-name
with the non-prefixed name of the event you want to fire.
Hi @jeherve! I think I picked a confusing name for the PR. :) This PR is part of the Remove duplicate views project and these tracks events are added only for WPCOM Simple and Atomic sites in order to have some parity with the events we trigger in Calypso pages and posts screens (/pages/ and /posts/). In Calypso, we have tracks for all of the post links we display in the hamburger menu: The equivalent for this menu is the quick links (below the post title) and the "Stats" column. |
Right, and we do some amount of customizing that classic Posts list screen with the Post List package already.
That package is loaded on Atomic sites here: jetpack/projects/plugins/wpcomsh/feature-plugins/post-list.php Lines 21 to 22 in a6f37e1
Since you're aiming to further customize the post list screen, I figured that package may be a good place for it? |
@jeherve I see your point and it could work. My concern was that since these events are meant only for WPCOM (Atomic and Simple), shipping it in posts-list package would mean also shipping it in Jetpack - the plugin. We could of course add some guards to only load it on WPCOM, but we would still ship the actual code with the plugin. :) I don't have a strong preference here. :) If you think it makes more sense to have it in posts-list package, let me know and I'll move it there. :) |
I'm not particularly worried about self-hosted sites here since the feature is not automatically activated and not surfaced in the modern settings page. Very few sites consequently use the module today. But even for those that do, tracking can work on self-hosted as well, and we can split between environments in Tracks. That said, I do not have any strong preference here either, feel free to ship this in the mu-wpcom plugin if you'd prefer. :) |
If changing it to work on self-hosted sites too (I use it!) then I guess we'd need to update "Does this pull request change what data or activity we track or use?" in the PR description, and I'm not sure what happens after that. |
Mostly nothing from your end. The HEs in charge of updating our support docs use that data to ensure the privacy sections of our support docs stay up to date. |
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.
Is that something that could be added directly to the Post List package?
To be honest, I wondered the same when I ported other Calypso features to WP Admin as part of the "Remove duplicate views" experiment (pfYzsZ-1o5-p2).
Should we port these features to Jetpack(-the-plugin) rather than to jetpack-mu-wpcom?
I think we have been relying more on jetpack-mu-wpcom to speed up the project process and don't involve Jetpack sites into the product discussion, but it's true that some of these features could benefit self-hosted sites too.
Also, IIRC, jetpack-mu-wpcom is deployed more frequently to WP.com Atomic sites than Jetpack(-the-plugin), which can be another contributing factor.
Said that, I would lean towards migrating all these missing features to jetpack-mu-wpcom for now, just for the sake of keeping the current momentum we have with the project, and remove the Calypso screens as soon as possible.
But I wouldn't be against reconsidering this approach either, if folks strongly feel we should make these features available to Jetpack sites too.
cc @Copons
projects/packages/jetpack-mu-wpcom/src/features/posts/post-list-tracking.php
Show resolved
Hide resolved
section: name, | ||
} | ||
|
||
window._tkq.push( [ 'recordEvent', 'wpcom_post_list_quick_links_clicked', props ] ); |
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.
Is window._tkq
always guaranteed to exist? I always assumed we need to initialize just in case. See PCYsg-4KT-p2
window._tkq = window._tkq || [];
I think the user is not identified by default when using window._tkq
directly, and you need to do it manually:
However, this library does not automatically populate the blog_id property, nor does it automatically identify the current user.
See this example for reference.
And now that I found that reference, maybe you can use the wpcomTrackEvent
helper?
Agreed! To be perfectly blunt, if we were to fill all the gaps, the Untangling project would take 10 years, and would be deprioritized in 2 months. 😄 |
|
||
?> | ||
<script> | ||
document.querySelectorAll( '.column-primary .row-actions span' ).forEach( ( span ) => { |
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.
Does this work if the user uses the Quick Edit to save a change and then uses a quick link?
Related to Automattic/wp-calypso#95621
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
wpcom_post_list_quick_links_clicked
triggeredwpcom_post_list_stats_clicked
event is triggered