-
Notifications
You must be signed in to change notification settings - Fork 293
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
Create the "Most popular products by pageviews" key metric widget tile #6249
Comments
ACs are good here, moving to IB 👍🏻 |
After talking with @aaemnnosttv and @jimmymadon we decided to solve the |
Set the Estimate to 30. We are making use of |
What's the thinking in using the It'd be helpful to know that here, because otherwise this feels a bit disjointed in terms of the actual use-case and how we would test this out, even in development. I see @derweili wrote the IB here but I know he won't be around to answer right away, so I'm assigning this to @jimmymadon as you wrote the ACs here and also the design doc. I think otherwise this looks good, but it just feels a bit abstract right now and I think it'd be worth clarifying things, possibly in the ACs as well, before moving this into the backlog. Sorry for not catching that in the ACs, to be fair. 😓 |
@tofumatt It is mentioned in the PRD where the metrics are listed. However, given that a site may have products/ecommerce without using CPTs, I agree that it won't always make sense to look for a product post type. A post type is something we can look at on the backend though to analyze its permalink structure in order to identify its prefix (assuming the site is even using pretty permalinks! Most do). The PRD also goes on to provide a fallback, if we can't determine what a product is. Ultimately, we need to identify something we can use in the Analytics query to filter with and that limits us to find something in the path. Ideally, we could provide the post type to Analytics as a custom dimension but that probably isn't something we can safely do (worth looking into as a future enhancement though). The implementation should be flexible so that it isn't specific to a plugin or post type but it's reasonable to use something generic as a starting point. From this perspective, perhaps maybe we should use a |
I noticed it mentioned in the PRD—I was actually asking where that came from, sorry that wasn't clear. My thinking was the PRD seems to assume that If we're looking to start with something very generic I suppose these URLs and CPTs are something, but they just seem to invite a lot of confusion and support requests around the many cases I can see them not working. Just from my own experience shopping on WordPress/WooCommerce sites, it does seem that What do you think about adding a little "Info" note or "Learn more" link here to a help doc explaining how we determine products here, @aaemnnosttv/@felixarntz/@marrrmarrr? |
QA Update:
|
c.c. @marrrmarrr Does the above sound good to you? |
@jimmymadon this SG, I'd just slightly change the message to say "Site Kit hasn't detected any products on your site yet" |
We should link to Analytics.
Regarding the wording here, I think it's important to note that this is based on nothing coming back from GA – we shouldn't make statements about there being no products on the site. It would be more accurate to say that we're "gathering data for products" or something like that. I'll defer to @marrrmarrr for the language to use but there's a key distinction to make that should help avoid confusion while remaining accurate if someone just added WC to their site or hasn't added any products yet, or products don't have any GA pageviews measured yet for whatever other reason 😄 |
@aaemnnosttv "gathering data" seems to imply that there are products and the user should just wait a bit to see the data, whereas in fact there is no data in GA (whether there are products or not, it seems like we can't establish with absolute certainty). So I'd suggest something like "Analytics has no data yet for products on your site" or similar. |
Back to you for another pass @wpdarren 👍 |
QA Update:
|
QA Update ✅Update on my comment above. I have had a conversation with @jimmymadon about this on Slack and we have agreed that a ticket needs to be created for the scenario I mention above where for a site that has no products, the tile does not disappear when WooCommerce (or any product post type) is disabled. Jimmy is going to create a ticket, and then it will be added to the bug bash board as a known issue. We need to think about the best way to implement this and don't have to do that now. Verified:
|
Feature Description
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
screenPageViews
pagePathPlusQueryString
screenPageViews
for the top 3 pages having a post type of "product" should be displayed next to their respective titles as per the Figma mock.Implementation Brief
Wait for Create the "New visitors" key metric widget tile #6244 and Create the "Top performing keywords" key metric widget tile #6251 to be merged.
In
includes/Core/Assets/Assets.php
get_product_base_paths()
.$product_base_paths
.product
post type exists, that the post type ispublic
and haswith_front
set to true.product
post type to the$product_base_paths
array.get_post_type_object('product')
which returns a[WP_Post_Type](https://developer.wordpress.org/reference/classes/wp_post_type/)
|null
public
property which is true if the post type is public.$rewrite
property which is an array, that has all required info about the rewrite base. The$post_type->rewrite['with_front']
can be used to determine if the plugin has a "base path".$post_type->rewrite['with_front']
can be used to get the "base path"$product_base_paths
array, but pass it through aapply_filter
so other e-commerce plugins can register their own product base path, even if their product post type is notproduct
.get_inline_base_data()
add new itemproductBasePaths
to$inline_data
use the new created method to get the value.In
assets/js/googlesitekit/datastore/site/info.js
productBasePaths
toRECEIVE_SITE_INFO
reducer.productBasePaths
to*getSiteInfo()
resolver.getProductBasePaths
, therefore duplicate thegetPostTypes
and change the name and property.Create
assets/js/modules/analytics-4/components/widgets/AnalyticsMostPopularProductsByPageviewWidget
which exports theAnalyticsMostPopularProductsByPageviewWidget
functional component.It should render the info as per the designs in Figma.
Use the
MetricTileTable
component created in Create the "Top performing keywords" key metric widget tile #6251 as a base.All styles should live in the assets/sass/components/key-metrics folder.
Use the new
select( CORE_SITE ).getProductBasePaths();
selector to get the product base paths.If
getProductBasePaths()
returns an empty array, return null for the whole widget component, as the widget can't be used if we don't have products.Query the GA4 data store via the
getReport
selector with the metric and dimension as per the AC.core/user
data store via thegetDateRangeDates
withcompare
set totrue
.getReport
to display the values as per the AC.dimensionFilters
. (see docs, 2. code example from docs is similar to what is needed here.).productBasePaths
array, create one expression thatpagePathPlusQueryString
as a fieldName.stringFilter
with thebasePath
as avalue
andBEGINS_WITH
as amatchType
.orGroup
to wrap the filter expressionsFormat the numbers as per the site's locale in the page-views column. See Format numbers in Key Metric Widget tiles #7190.
Create assets/js/modules/analytics-4/components/widgets/AnalyticsMostPopularProductsByPageviewWidget.stories.js
Test Coverage
get_product_base_paths()
. Should cover test cases forproduct
post type not registeredproduct
post type registered but not pretty permalinks activatedproduct
post type registered but not publicproduct
post type registered but no rewrite baseproduct
post type registered, is public and with rewrite baseAnalyticsMostPopularProductsByPageviewWidget
QA Brief
userInput
feature flag enabled, answer the questionnaire./en/why-%product%/
as the custom permalink structure for products. This will make the widget use/en/why-
prefix when it gets report data to let you see some data in the widget.Most popular products by pageviews
widget, it should show the most viewed pages whom URLs start from/en/why-
.Changelog entry
The text was updated successfully, but these errors were encountered: