From 2c3c8214aa6ebf85fad4e7a7caa453bbe02a1a0e Mon Sep 17 00:00:00 2001 From: bogdanungureanu Date: Thu, 9 Jan 2025 18:02:12 +0200 Subject: [PATCH 1/2] Post list: Add track events for quick links and stats --- .../changelog/update-tracking-for-posts-list | 5 ++ .../src/class-jetpack-mu-wpcom.php | 1 + .../src/features/posts/post-list-tracking.php | 73 +++++++++++++++++++ .../src/features/posts/posts.php | 8 ++ 4 files changed, 87 insertions(+) create mode 100644 projects/packages/jetpack-mu-wpcom/changelog/update-tracking-for-posts-list create mode 100644 projects/packages/jetpack-mu-wpcom/src/features/posts/post-list-tracking.php create mode 100644 projects/packages/jetpack-mu-wpcom/src/features/posts/posts.php diff --git a/projects/packages/jetpack-mu-wpcom/changelog/update-tracking-for-posts-list b/projects/packages/jetpack-mu-wpcom/changelog/update-tracking-for-posts-list new file mode 100644 index 0000000000000..ec9c5aea3a621 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/changelog/update-tracking-for-posts-list @@ -0,0 +1,5 @@ +Significance: patch +Type: added +Comment: Adds tracking for post list quick links and post stats for WPCOM + + diff --git a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php index 8234c0d13aa7e..e53c58fb8a896 100644 --- a/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php +++ b/projects/packages/jetpack-mu-wpcom/src/class-jetpack-mu-wpcom.php @@ -144,6 +144,7 @@ public static function load_wpcom_user_features() { require_once __DIR__ . '/features/help-center/class-help-center.php'; } require_once __DIR__ . '/features/pages/pages.php'; + require_once __DIR__ . '/features/posts/posts.php'; require_once __DIR__ . '/features/replace-site-visibility/replace-site-visibility.php'; require_once __DIR__ . '/features/wpcom-admin-bar/wpcom-admin-bar.php'; require_once __DIR__ . '/features/wpcom-admin-interface/wpcom-admin-interface.php'; diff --git a/projects/packages/jetpack-mu-wpcom/src/features/posts/post-list-tracking.php b/projects/packages/jetpack-mu-wpcom/src/features/posts/post-list-tracking.php new file mode 100644 index 0000000000000..f7572bff9a162 --- /dev/null +++ b/projects/packages/jetpack-mu-wpcom/src/features/posts/post-list-tracking.php @@ -0,0 +1,73 @@ + + + + + + Date: Thu, 9 Jan 2025 18:10:33 +0200 Subject: [PATCH 2/2] Fix linting --- .../src/features/posts/post-list-tracking.php | 2 +- .../jetpack-mu-wpcom/src/features/posts/posts.php | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/projects/packages/jetpack-mu-wpcom/src/features/posts/post-list-tracking.php b/projects/packages/jetpack-mu-wpcom/src/features/posts/post-list-tracking.php index f7572bff9a162..fd8820431903c 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/posts/post-list-tracking.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/posts/post-list-tracking.php @@ -52,7 +52,7 @@ function wpcom_add_tracking_for_posts_lists() { function wpcom_post_list_add_stats_tracking() { global $post_type; - if ( ! in_array( $post_type, array('post', 'page') ) ) { + if ( ! in_array( $post_type, array( 'post', 'page' ), true ) ) { return; } ?> diff --git a/projects/packages/jetpack-mu-wpcom/src/features/posts/posts.php b/projects/packages/jetpack-mu-wpcom/src/features/posts/posts.php index d7540f63c8085..ee82ecd7f19c6 100644 --- a/projects/packages/jetpack-mu-wpcom/src/features/posts/posts.php +++ b/projects/packages/jetpack-mu-wpcom/src/features/posts/posts.php @@ -1,8 +1,4 @@ -