-
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
Store: Move product stats to store #21770
Conversation
Test live in Docker at: https://dserve.a8c.com/?branch=update/store-product-stats |
e4f2c52
to
157f542
Compare
157f542
to
7fab50d
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.
I'm not seeing any debug statements when running on a test site. I can see tracks elsewhere in Store being discarded - like I deleted a product category and confirmed I could see the messaging then... but when editing a product I'm not seeing anything.
|
||
if ( tracksStore.isTestSite() ) { | ||
debug( 'stat bump discarded. this site is flagged with `dotcom-store-test-site`' ); | ||
return { type: WOOCOMMERCE_STAT_DISCARDED, group, name }; |
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.
so now with an action being returned we could even have some test coverage around test site stats being discarded correct?
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.
Yup with some mocking. Though the import/reliance on the main 'lib/analytics' for the other method makes testing a bit hard because window
is assumed to exist. Though if we are going to stop relying on our special track function we can clean that up a bit.
|
||
if ( tracksStore.isTestSite() ) { | ||
debug( 'stat bump discarded. this site is flagged with `dotcom-store-test-site`' ); | ||
return { type: WOOCOMMERCE_STAT_DISCARDED, group, name }; |
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.
Oooh - I like this
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.
When I actually checked out this branch, it tested out as expected for test and non test sites. 😄
If you can migrate this one too, that would close #21498 (and if not, no worries, I'll do it) ./app/dashboard/store-location-setup-view.js: this.props.bumpStat( 'calypso_woo_store_setup_country', this.state.address.country ); |
@justinshreve - I didn't see any code change in 71937b7 for the store location stat |
@allendav I changed the import in that commit but otherwise its the same. |
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.
Works great. Also noted setup country stats bumping is properly discarded for test sites.
Per our chat earlier, this branch movies the MC stat bump and track events away from being done server side (
mu-plugins/tracks/hooks/woocommerce.php
) to being handled via Calypso. The events are renamed and I'll keep the PHP hooks running for a bit so we can compare numbers (since it's our assumption the product count is inflated).To Test:
npm run test-client client/extensions/woocommerce
and make sure all tests pass.localStorage.setItem('debug', '*analytics*');
calypso_woo_store_setup_country
in your console.