Skip to content
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

Merged
merged 2 commits into from
Jan 24, 2018
Merged

Conversation

justinshreve
Copy link
Contributor

@justinshreve justinshreve commented Jan 23, 2018

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:

  • Run npm run test-client client/extensions/woocommerce and make sure all tests pass.
  • Open your console and paste localStorage.setItem('debug', '*analytics*');
  • Create a product and make sure you see both the analytic event and the 'bump stat' event.
  • Update a product and make sure you see both the analytic event and the 'bump stat' event.
  • Reset your setup flags and go through the address setup step, looking for calypso_woo_store_setup_country in your console.
  • Following the FG page (linked on our P2), remove the blog sticker to make sure the stat bump is not blocked and retest.

@matticbot
Copy link
Contributor

Test live in Docker at: https://dserve.a8c.com/?branch=update/store-product-stats

@justinshreve justinshreve added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. Store labels Jan 23, 2018
@justinshreve justinshreve self-assigned this Jan 23, 2018
@justinshreve justinshreve changed the title Store: Move product stats to extension Store: Move product stats to store Jan 23, 2018
@justinshreve justinshreve added [Status] In Progress and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jan 23, 2018
@justinshreve justinshreve force-pushed the update/store-product-stats branch from e4f2c52 to 157f542 Compare January 23, 2018 22:37
@justinshreve justinshreve added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Jan 23, 2018
@justinshreve justinshreve force-pushed the update/store-product-stats branch from 157f542 to 7fab50d Compare January 23, 2018 23:10
Copy link
Contributor

@timmyc timmyc left a 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 };
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@timmyc
Copy link
Contributor

timmyc commented Jan 23, 2018

Likewise when creating a new product, I'm not seeing any messaging:

product-create


if ( tracksStore.isTestSite() ) {
debug( 'stat bump discarded. this site is flagged with `dotcom-store-test-site`' );
return { type: WOOCOMMERCE_STAT_DISCARDED, group, name };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh - I like this

Copy link
Contributor

@timmyc timmyc left a 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. 😄

@allendav
Copy link
Contributor

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 );

@allendav
Copy link
Contributor

@justinshreve - I didn't see any code change in 71937b7 for the store location stat

@justinshreve
Copy link
Contributor Author

@allendav I changed the import in that commit but otherwise its the same.

Copy link
Contributor

@allendav allendav left a 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. :shipit:

@justinshreve justinshreve merged commit 5500889 into master Jan 24, 2018
@justinshreve justinshreve deleted the update/store-product-stats branch January 25, 2018 18:57
@sirreal sirreal removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants