markafitzgerald1 / cribbage-trainer

Two-player cribbage discard and play improvement tool.
Mozilla Public License 2.0
1 stars 0 forks source link

Measure user usage of the Cribbage Trainer automatically deployed to GitHub Pages #21

Open markafitzgerald1 opened 9 months ago

markafitzgerald1 commented 9 months ago

At present there is no available measure of how much traffic the automatically deployed to GitHub Pages version of Cribbage Trainer is getting, if any.

Add some sort of tracker so that once the application is getting traffic, it's application development and roadmap can be adjusted and fine-tuned based on its global usage information and trends.

markafitzgerald1 commented 8 months ago

I'm currently investigating whether Google Analytics will suffice as a starting point to provide basic user usage info.

markafitzgerald1 commented 8 months ago

Consider adding per user action tracking as well for:

in order to measure how much users use the app per page load. (#6 will affect these analytics, allowing users to stay on the same page without reloading for multiple hands.)

markafitzgerald1 commented 8 months ago

The Google Analytics Terms and Conditions requires a Privacy Policy and user consent to Google Analytics cookies and/or local storage in section 7. Privacy:

You will have and abide by an appropriate Privacy Policy and will comply with all applicable laws, policies, and regulations relating to the collection of information from Users. You must post a Privacy Policy and that Privacy Policy must provide notice of Your use of cookies, identifiers for mobile devices (e.g., Android Advertising Identifier or Advertising Identifier for iOS) or similar technology used to collect data. You must disclose the use of Google Analytics, and how it collects and processes data. This can be done by displaying a prominent link to the site "How Google uses information from sites or apps that use our services", (located at www.google.com/policies/privacy/partners/, or any other URL that Google may provide from time to time). You will use commercially reasonable efforts to ensure that a User is provided with clear and comprehensive information about, and consents to, the storing and accessing of cookies or other information on the Userโ€™s device where such activity occurs in connection with the Service and where providing such information and obtaining such consent is required by law.

Working on that now.

markafitzgerald1 commented 8 months ago

Adding Storybook to more effectively iterate on the Google Analytics consent widget before incorporating it into the main user interface.

markafitzgerald1 commented 8 months ago

Branch and draft PR created with dependencies updated and deploy to production disabled for non-main branches.

GitHub repository settings updated to require PR passing build and test check before merge to main to avoid any future production outages due to GitHub Actions detectable issues.

markafitzgerald1 commented 8 months ago

Storybook does not appear to support Parcel. Default Storybook instructions only show how to use it with Webpack and Vite. Vite seems to be more future-proof and its use of ECMAScript modules very likely works with the evergreen browsers this project is targeting. Perhaps consider a move to Vite via this migration guide from Parcel) as a supported path to using Storybook? There's no obvious sign of Parcel support coming to Storybook and a move to Vite would buy some local development performance gains. Also, Storybook based UI component development looks rather awesome!

markafitzgerald1 commented 8 months ago

TIL: The GitHub Pages Action has a feature in development to:

deploy a pull request as a GitHub Pages preview site

The feature is still in non-public alpha, but let's monitor to enable the possibility of deploys to a preview site from PRs.

markafitzgerald1 commented 8 months ago

Install and use of Vite followed by disuse and uninstall of Parcel may be easier and another than using a third party migration guide.

markafitzgerald1 commented 8 months ago

Replaced Parcel with Vite in 633c7d6bd66cf2c6898183d46d2e39082ad202b2.

markafitzgerald1 commented 7 months ago

The Package production dependency looks like an accidental error. Please remove in this PR if it is the next one to merge into main.

markafitzgerald1 commented 7 months ago

Storybook with Card stories added in 4281a13c95087af80a10579c59fde3c097b4cbec.

markafitzgerald1 commented 7 months ago

Package dependency removed in 8aaa89a6d56748e9473c263a326f17bfa1b374e7.

markafitzgerald1 commented 7 months ago

Storybook Test Runner incorporated in local and GitHub Actions checks in 81f6df8.

markafitzgerald1 commented 7 months ago

PR branch getting too big: 9,654 lines added and 3,421 lines removed. I think I'll start merging the supporting changes for the resolution of this issue into main one at a time to reduce PR size and branch duration (currently 25 days old) in order to keep non-merged work in progress size more manageable and understandable.

markafitzgerald1 commented 7 months ago

Automated local serving of Storybook for Storybook tests in the 21-measure-cribbage-trainer-github-pages-usage branch to automate one sometimes needed local development separate step.

markafitzgerald1 commented 7 months ago

Adding Storybook well will likely require modifying how the existing components work as stories are added.

TODO:

markafitzgerald1 commented 7 months ago

822cfae pushed to this branch and draft PR to simplify the Card component to fire events instead of directly modifying state via parent component overall hand state hook calls.

markafitzgerald1 commented 6 months ago

CardLabel stories added in 127963b8a34fc7f9f2b33ca17c209f879a3f18c9.

markafitzgerald1 commented 6 months ago

Probably PossibleHand is next to get Storybook stories, or perhaps Hand.

markafitzgerald1 commented 6 months ago

PR has gotten too big. Will merge it into main, then continue on this issue using trunk-based development to reduce cognitive load (only one branch) and keep the tip of development production tested.

Issue resolution strategy remains the same: supporting technical infrastructure before feature + issue remains open until both technical support and the feature are complete with minimal technical debt, where all technical debt is captured in Issues.

markafitzgerald1 commented 6 months ago

TODO:

markafitzgerald1 commented 6 months ago

First three commits of the PR (#27) now exist in main:

Next: add Storybook in main.

markafitzgerald1 commented 6 months ago

Next three commits of the PR (#27) now exist in main:

Next: use the Storybook Test Runner.

markafitzgerald1 commented 6 months ago

TODO:

markafitzgerald1 commented 6 months ago

test(Storybook): Use test runner and the five commits after it to fix its issues in CI and local development all now in main and deployed to production.

Commits left to get into main:

Then chances are PR #27 can be closed as it should equal or be very close to equal to main.

markafitzgerald1 commented 6 months ago

๐Ÿž fix(Card): Minimize per components props is now in main, but it contains the regression where clicking between the card border and the card text does not result in card select/deselect happening. I believe it's fixed in the last commit - will try merging that commit in now.

markafitzgerald1 commented 6 months ago

Pausing work on this until some known bugs get fixed: #33, #31, #12.

markafitzgerald1 commented 6 months ago

31 closed.

12 deferred until after #26, which will happen naturally a little after this Issue (#21).

33 in progress and will get closed during next PR or two of this Issue (#21).

Resuming work on this Issue (#21), which will naturally result in #33 closing out before #21 anyways.

markafitzgerald1 commented 6 months ago

PossibleHand feels like the next candidate component for which Storybook stories should be added.

markafitzgerald1 commented 6 months ago

PossibleHand stories added in #44.

markafitzgerald1 commented 6 months ago

ScoredPossibleKeepDiscard stories added in #48.

markafitzgerald1 commented 5 months ago

Hand stories added in https://github.com/markafitzgerald1/cribbage-trainer/pull/58.

markafitzgerald1 commented 5 months ago

SortOrderInput stories added in #59.

markafitzgerald1 commented 5 months ago

TODO inherited from #70:

markafitzgerald1 commented 4 months ago

SortableHand stories added in #78.

markafitzgerald1 commented 4 months ago

ScoredPossibleKeepDiscards stories added in https://github.com/markafitzgerald1/cribbage-trainer/pull/79.

markafitzgerald1 commented 4 months ago

Trainer story added in #80.

markafitzgerald1 commented 4 months ago

Storybook static site now automatically published to https://markafitzgerald1.github.io/cribbage-trainer/storybook/ with #81 and #82.

markafitzgerald1 commented 4 months ago

Minor glitch with Docs view of Trainer Story acceptable for now - can fix it in https://github.com/markafitzgerald1/cribbage-trainer/issues/83 later.

markafitzgerald1 commented 4 months ago

Next up:

markafitzgerald1 commented 4 months ago

Locally wrote a Storybook Interaction Test of hand sort in Trainer. It warns in the browser console, but passes npx test-storybook.

A Storybook test may be required here as the development version of the component is used in Storybook, and that version of the component does not fail to work during test execution.

TODO:

markafitzgerald1 commented 4 months ago

Confirmed that act() in code + Playwright test using production preview server catches the use of act() due to UI not changing or looking as expected after click on different sort order radio button.

markafitzgerald1 commented 4 months ago

Bottom line: both the Storybook Interaction test and the Playwright test can catch the issue when run against production app servers.

markafitzgerald1 commented 4 months ago

Regression test for #70 added in https://github.com/markafitzgerald1/cribbage-trainer/pull/86.

Next up: analytics consent UI create!

markafitzgerald1 commented 4 months ago

Privacy Policy component created and added to Storybook but not added to main user interface in https://github.com/markafitzgerald1/cribbage-trainer/pull/87.

markafitzgerald1 commented 4 months ago

The privacy policy was created with Google Bard using the parts of Google Analytics Terms of Service Section 7, Privacy that require a Privacy Policy from using applications as input.

markafitzgerald1 commented 4 months ago

One missing TODO item once the Privacy Policy and a working user consent are on the GitHub Pages deployed site:

markafitzgerald1 commented 4 months ago

There are plenty of user consent to the user of analytics examples on the Internet that can be used to form one for this app. See the Images tab at https://www.google.com/search?q=analytics+user+consent+dialog+examples for some of them.

markafitzgerald1 commented 4 months ago

Analytics Consent dialog with Accept and Decline buttons progressing nicely in local development. Close to ready to push as a Storybook only component before integration work begins.

markafitzgerald1 commented 3 months ago

Pushed Analytics Consent dialog in 68d8854eb06b12cd9257a725057622feb8553e4e.