Repository navigation
Track custom post type usage - #26100
Conversation
Generated by 🚫 Danger |
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 36122 | |
| Version | PR #26100 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 3105171 | |
| Installation URL | 4dvh6pdsqjo2g |
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 36122 | |
| Version | PR #26100 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 3105171 | |
| Installation URL | 00fi8oqcfss20 |
|
I'll tweak the solution due to new changes in the trunk branch. |
Send custom_post_types_fetched once per site per app process with the counts and slugs of the custom post types the app lists and of the hidden plugin or theme types, plus the hosting type and site identity. The custom predicate is shared with the site menu query.
48bc9f3 to
449ff4f
Compare
|
Version |
jkmassel
left a comment
There was a problem hiding this comment.
From Claude: Two suggestions that make the post_type change additive. They depend on each other, so apply them as one batch. Built with both applied; CustomPostListAnalyticsTests, CustomPostTypeUsageTrackerTests and PostTypeClassificationTests pass (18 tests) on an iOS 27.2 simulator, and swift-format / SwiftLint are clean.
If this is taken, the description's item 2, the cpt_post_list_opened example and the second testing step need updating to say post_type_slug.
| return [ | ||
| "post_type": endpoint == .posts ? "posts" : (isPages ? "pages" : "custom"), | ||
| "post_type": details.slug, |
There was a problem hiding this comment.
Finding from Claude:
This changes post_type on cpt_post_list_opened and cpt_post_list_load_finished, which shipped in 27.4. Old app versions send posts / pages / custom, and new ones would send the slug (post, page, product, …) in the same column. Last week (Nov 8–14) that was about 11,600 cpt_post_list_opened events across both apps, all with the old values, so any query or dashboard grouping on them would split at rollout.
Suggest keeping post_type as it is and sending the slug as a new post_type_slug property:
| return [ | |
| "post_type": endpoint == .posts ? "posts" : (isPages ? "pages" : "custom"), | |
| "post_type": details.slug, | |
| let postType: String | |
| switch details.toPostEndpointType() { | |
| case .posts: postType = "posts" | |
| case .pages: postType = "pages" | |
| default: postType = "custom" | |
| } | |
| return [ | |
| "post_type": postType, | |
| "post_type_slug": details.slug, |
| @Test(arguments: [ | ||
| ("post", "posts"), | ||
| ("page", "pages"), | ||
| ("job_listing", "job_listing") | ||
| ]) | ||
| func postTypeIsSlug(slug: String, restBase: String) { | ||
| let properties = CustomPostListViewModel.analyticsProperties( | ||
| details: .fixture(slug: slug, restBase: restBase), | ||
| filter: CustomPostListFilter(tab: .all), | ||
| hierarchyEligible: false, | ||
| hasCachedContent: false | ||
| ) | ||
| #expect(properties["post_type"] as? String == slug) | ||
| } |
There was a problem hiding this comment.
Finding from Claude:
Test update to match the suggestion above (apply both together):
| @Test(arguments: [ | |
| ("post", "posts"), | |
| ("page", "pages"), | |
| ("job_listing", "job_listing") | |
| ]) | |
| func postTypeIsSlug(slug: String, restBase: String) { | |
| let properties = CustomPostListViewModel.analyticsProperties( | |
| details: .fixture(slug: slug, restBase: restBase), | |
| filter: CustomPostListFilter(tab: .all), | |
| hierarchyEligible: false, | |
| hasCachedContent: false | |
| ) | |
| #expect(properties["post_type"] as? String == slug) | |
| } | |
| @Test(arguments: [ | |
| ("post", "posts", "posts"), | |
| ("page", "pages", "pages"), | |
| ("job_listing", "job_listing", "custom") | |
| ]) | |
| func postTypeKeepsCategoryAndAddsSlug(slug: String, restBase: String, category: String) { | |
| let properties = CustomPostListViewModel.analyticsProperties( | |
| details: .fixture(slug: slug, restBase: restBase), | |
| filter: CustomPostListFilter(tab: .all), | |
| hierarchyEligible: false, | |
| hasCachedContent: false | |
| ) | |
| #expect(properties["post_type"] as? String == category) | |
| #expect(properties["post_type_slug"] as? String == slug) | |
| } |
🤖 Build Failure AnalysisThis build has failures. Claude has analyzed them - check the build annotations for details. |


Description
Fixes https://linear.app/a8c/issue/CMM-2450
To measure which custom post types sites use:
custom_post_types_fetchedafter syncing post types, once per site per app process. Include counts and slugs for types the app lists and hidden plugin or theme types, plus hosting type.post_type. This changes values fromposts,pages, orcustomtopost,page, or a custom slug such asproduct.Both include
blog_idwhen available andsite_type. Slug lists are JSON strings because Tracks rejects array properties.Example properties for the new
custom_post_types_fetchedevent on a Jetpack-connected site:{ "custom_post_type_count": 2, "custom_post_type_slugs": "[\"job_listing\",\"product\"]", "hidden_post_type_count": 1, "hidden_post_type_slugs": "[\"give_forms\"]", "blog_type": "jetpack", "blog_id": 42, "site_type": "blog" }Example properties for the updated
cpt_post_list_openedevent:{ "post_type": "product", // Changed from "custom" to the actual post type slug. "tab": "all", "page_size": 20, "hierarchy_eligible": false, "has_cached_content": false, "blog_id": 42, // Added when the site has a WordPress.com ID. "site_type": "blog" // Added: "blog" or "p2". }cpt_post_list_load_finishedreceives the same slug and site properties alongside its existing load metrics.Testing instructions
custom_post_types_fetchedfires once, then fires again after restarting the app and refreshing.post_typeslug and site properties.