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

Enhance/#6738 - Create new SetupFormGA4 component #6808

Merged
merged 34 commits into from
Apr 4, 2023

Conversation

hussain-t
Copy link
Collaborator

@hussain-t hussain-t commented Apr 3, 2023

Summary

Addresses issue:

Relevant technical choices

  • This PR doesn't add tests for the new SetupFormGA4 component as it requires more effort. In addition, writing basic tests is not possible without providing proper mocks for the analytics and analytics-4 modules.
  • Clearing/resetting the settings when the toggle is disabled resets the property entirely. It looks odd and is not a good UX. Please refer to the screenshot below. I discussed this with @nfmohit, and we decided to reset it in the submit changes.

Screenshot 2023-04-03 at 3 23 13 PM

PR Author Checklist

  • My code is tested and passes existing unit tests.
  • My code has an appropriate set of unit tests which all pass.
  • My code is backward-compatible with WordPress 5.2 and PHP 5.6.
  • My code follows the WordPress coding standards.
  • My code has proper inline documentation.
  • I have added a QA Brief on the issue linked above.
  • I have signed the Contributor License Agreement (see https://cla.developers.google.com/).

Do not alter or remove anything below. The following sections will be managed by moderators only.

Code Reviewer Checklist

  • Run the code.
  • Ensure the acceptance criteria are satisfied.
  • Reassess the implementation with the IB.
  • Ensure no unrelated changes are included.
  • Ensure CI checks pass.
  • Check Storybook where applicable.
  • Ensure there is a QA Brief.

Merge Reviewer Checklist

  • Ensure the PR has the correct target branch.
  • Double-check that the PR is okay to be merged.
  • Ensure the corresponding issue has a ZenHub release assigned.
  • Add a changelog message to the issue.

@github-actions
Copy link

github-actions bot commented Apr 3, 2023

Size Change: +1.5 kB (0%)

Total Size: 1.23 MB

Filename Size Change
./dist/assets/js/32-********************.js 3.12 kB -1 B (0%)
./dist/assets/js/googlesitekit-adminbar-********************.js 31.7 kB +8 B (0%)
./dist/assets/js/googlesitekit-api-********************.js 9.58 kB +2 B (0%)
./dist/assets/js/googlesitekit-components-gm2-********************.js 6.03 kB -1 B (0%)
./dist/assets/js/googlesitekit-components-gm3-********************.js 9.73 kB -3 B (0%)
./dist/assets/js/googlesitekit-data-********************.js 2.15 kB -6 B (0%)
./dist/assets/js/googlesitekit-datastore-forms-********************.js 9.21 kB -1 B (0%)
./dist/assets/js/googlesitekit-datastore-site-********************.js 16.3 kB -2 B (0%)
./dist/assets/js/googlesitekit-datastore-ui-********************.js 9.29 kB +1 B (0%)
./dist/assets/js/googlesitekit-datastore-user-********************.js 22.2 kB +10 B (0%)
./dist/assets/js/googlesitekit-entity-dashboard-********************.js 63.3 kB +28 B (0%)
./dist/assets/js/googlesitekit-main-dashboard-********************.js 74.5 kB +27 B (0%)
./dist/assets/js/googlesitekit-modules-adsense-********************.js 72.6 kB +403 B (+1%)
./dist/assets/js/googlesitekit-modules-analytics-4-********************.js 27.5 kB +4 B (0%)
./dist/assets/js/googlesitekit-modules-analytics-********************.js 81.3 kB +555 B (+1%)
./dist/assets/js/googlesitekit-modules-********************.js 20.6 kB +22 B (0%)
./dist/assets/js/googlesitekit-modules-optimize-********************.js 18.8 kB +8 B (0%)
./dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 21.2 kB +5 B (0%)
./dist/assets/js/googlesitekit-modules-search-console-********************.js 48.5 kB +9 B (0%)
./dist/assets/js/googlesitekit-modules-tagmanager-********************.js 32.3 kB +168 B (+1%)
./dist/assets/js/googlesitekit-settings-********************.js 47 kB +16 B (0%)
./dist/assets/js/googlesitekit-splash-********************.js 65.2 kB +8 B (0%)
./dist/assets/js/googlesitekit-user-input-********************.js 39.8 kB +2 B (0%)
./dist/assets/js/googlesitekit-vendor-********************.js 319 kB -1 B (0%)
./dist/assets/js/googlesitekit-widgets-********************.js 16.5 kB +7 B (0%)
./dist/assets/js/googlesitekit-wp-dashboard-********************.js 57 kB +227 B (0%)
./dist/assets/js/runtime-********************.js 1.26 kB +1 B (0%)
ℹ️ View Unchanged
Filename Size
./dist/assets/css/googlesitekit-admin-css-********************.min.css 48.3 kB
./dist/assets/css/googlesitekit-adminbar-css-********************.min.css 11.1 kB
./dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 7.31 kB
./dist/assets/js/29-********************.js 2.8 kB
./dist/assets/js/30-********************.js 2.28 kB
./dist/assets/js/31-********************.js 3.72 kB
./dist/assets/js/analytics-advanced-tracking-********************.js 769 B
./dist/assets/js/googlesitekit-activation-********************.js 22.5 kB
./dist/assets/js/googlesitekit-datastore-location-********************.js 2.09 kB
./dist/assets/js/googlesitekit-i18n-********************.js 3.92 kB
./dist/assets/js/googlesitekit-polyfills-********************.js 378 B

compressed-size-action

Copy link
Collaborator

@tofumatt tofumatt left a comment

Choose a reason for hiding this comment

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

Overall looks good. A few questions and a few changes needed I think, but overall looks great. 👍🏻

const onChange = useCallback( () => {
setValues( FORM_SETUP, { enableUA: ! isUAEnabled } );

trackEvent( `${ viewContext }_analytics`, 'enable_ua' );
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see this event mentioned anywhere in the issue's ACs or IB, and it isn't in the list of Custom Analytics Events for Site Kit either. Was this discussion elsewhere (in Slack or something)? I just want to make sure we have the okay from @marrrmarrr to add this event to the plugin 🙂

Suggested change
trackEvent( `${ viewContext }_analytics`, 'enable_ua' );
trackEvent( `${ viewContext }_analytics`, 'enable_ua' );

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right. It's not mentioned anywhere. I added it. I will remove it. We can add it later if we need an event 👍

checked={ isUAEnabled }
onClick={ onChange }
hideLabel={ false }
disabled={ false }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we explicitly need to set disabled to false? That seems a bit odd is all—I don't see that anywhere else in the codebase 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch. Removed it 👍

@@ -1,7 +1,7 @@
/**
* Analytics GA4 Setup form.
*
* Site Kit by Google, Copyright 2021 Google LLC
* Site Kit by Google, Copyright 2023 Google LLC
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Site Kit by Google, Copyright 2023 Google LLC
* Site Kit by Google, Copyright 2021 Google LLC

This file is from 2021, let's leave this alone. The copyright year for the file should be when it was first created.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated.

@@ -1,7 +1,7 @@
/**
* SetupFormGA4 component stories.
*
* Site Kit by Google, Copyright 2021 Google LLC
* Site Kit by Google, Copyright 2023 Google LLC
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Site Kit by Google, Copyright 2023 Google LLC
* Site Kit by Google, Copyright 2021 Google LLC

Same here, let's leave this as-it-was.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated.

@@ -0,0 +1,131 @@
/**
* Analytics GA4 Setup form Legacy.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Analytics GA4 Setup form Legacy.
* Analytics GA4 Setup form (legacy version, supports UA setup).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated.

Comment on lines 140 to 144
// If `ga4Reporting` AND `enableUA` are both enabled, we need to reset the
// property and profile IDs to ensure that the UA settings are not saved.
if ( ga4ReportingEnabled && ! isUAEnabled ) {
dispatch( MODULES_ANALYTICS ).resetPropertyAndProfileIDs();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The code comment here mentions GA4 and "Enable UA" both being enabled, but the code here is checking for GA4 Reporting being enabled and UA being disabled. 🤔

I think the code logic is right, just the comment needs to be updated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Correct. Updated it.

// Do not require selecting a property or profile if `ga4Reporting` is enabled.
// Therefore, only validate these if `ga4Reporting` is not enabled.
if ( ! isFeatureEnabled( 'ga4Reporting' ) ) {
// Therefore, only validate these if `ga4Reporting` is not enabled OR `enableUA` is enabled.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Therefore, only validate these if `ga4Reporting` is not enabled OR `enableUA` is enabled.
// Only validate UA settings if `ga4Reporting` is not enabled OR `enableUA` is enabled.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated.

@tofumatt tofumatt changed the base branch from develop to main April 4, 2023 20:19
@tofumatt tofumatt changed the base branch from main to develop April 4, 2023 20:21
@tofumatt tofumatt changed the base branch from develop to main April 4, 2023 20:21
@tofumatt tofumatt merged commit 6ea9e69 into main Apr 4, 2023
14 checks passed
@tofumatt tofumatt deleted the enhance/#6738-create-setup-form-ga4 branch April 4, 2023 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants