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

Consider Analytics Ads linked status in Consent Mode conditions #8431

Merged
merged 12 commits into from
Apr 1, 2024

Conversation

nfmohit
Copy link
Collaborator

@nfmohit nfmohit commented Mar 27, 2024

Summary

Addresses issue:

Relevant technical choices

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.

Copy link

github-actions bot commented Mar 27, 2024

Build files for 6ae739b have been deleted.

Copy link

github-actions bot commented Mar 27, 2024

Size Change: -471 B (0%)

Total Size: 1.41 MB

Filename Size Change
./dist/assets/css/googlesitekit-admin-css-********************.min.css 53 kB +35 B (0%)
./dist/assets/js/34-********************.js 3.12 kB -1 B (0%)
./dist/assets/js/googlesitekit-activation-********************.js 23.8 kB +10 B (0%)
./dist/assets/js/googlesitekit-ad-blocking-recovery-********************.js 57.3 kB -47 B (0%)
./dist/assets/js/googlesitekit-adminbar-********************.js 34.1 kB -44 B (0%)
./dist/assets/js/googlesitekit-api-********************.js 10 kB +6 B (0%)
./dist/assets/js/googlesitekit-components-gm2-********************.js 5.88 kB +15 B (0%)
./dist/assets/js/googlesitekit-components-gm3-********************.js 10 kB -1 B (0%)
./dist/assets/js/googlesitekit-data-********************.js 2.17 kB -2 B (0%)
./dist/assets/js/googlesitekit-datastore-forms-********************.js 9.12 kB +5 B (0%)
./dist/assets/js/googlesitekit-datastore-site-********************.js 19 kB +658 B (+4%)
./dist/assets/js/googlesitekit-datastore-ui-********************.js 10.1 kB +8 B (0%)
./dist/assets/js/googlesitekit-datastore-user-********************.js 24.4 kB -20 B (0%)
./dist/assets/js/googlesitekit-entity-dashboard-********************.js 66.7 kB -125 B (0%)
./dist/assets/js/googlesitekit-main-dashboard-********************.js 91.1 kB -130 B (0%)
./dist/assets/js/googlesitekit-modules-********************.js 21.7 kB +3 B (0%)
./dist/assets/js/googlesitekit-modules-ads-********************.js 16.7 kB -14 B (0%)
./dist/assets/js/googlesitekit-modules-adsense-********************.js 111 kB -153 B (0%)
./dist/assets/js/googlesitekit-modules-analytics-4-********************.js 111 kB -115 B (0%)
./dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 22.5 kB -2 B (0%)
./dist/assets/js/googlesitekit-modules-search-console-********************.js 57.8 kB -131 B (0%)
./dist/assets/js/googlesitekit-modules-tagmanager-********************.js 30 kB -17 B (0%)
./dist/assets/js/googlesitekit-settings-********************.js 58.8 kB -245 B (0%)
./dist/assets/js/googlesitekit-splash-********************.js 71.9 kB -63 B (0%)
./dist/assets/js/googlesitekit-user-input-********************.js 46.8 kB -17 B (0%)
./dist/assets/js/googlesitekit-vendor-********************.js 316 kB +1 B (0%)
./dist/assets/js/googlesitekit-widgets-********************.js 33.2 kB -41 B (0%)
./dist/assets/js/googlesitekit-wp-dashboard-********************.js 59.9 kB -45 B (0%)
./dist/assets/js/runtime-********************.js 1.3 kB +1 B (0%)
ℹ️ View Unchanged
Filename Size
./dist/assets/css/googlesitekit-adminbar-css-********************.min.css 11.2 kB
./dist/assets/css/googlesitekit-wp-dashboard-css-********************.min.css 7.47 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/32-********************.js 930 B
./dist/assets/js/33-********************.js 888 B
./dist/assets/js/analytics-advanced-tracking-********************.js 778 B
./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 379 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.

Looks good, just one idea for a small improvement before we merge.

Comment on lines 50 to 58
const isAdsConnected = useSelect( ( select ) => {
// TODO: Replace the `getAdsConversionID()` selector with its `ads`
// version once it's implemented.

const { getAdsConversionID, getAdsLinked } =
select( MODULES_ANALYTICS_4 );

return getAdsConversionID() || getAdsLinked();
} );
Copy link
Collaborator

Choose a reason for hiding this comment

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

This exact logic is used across three different components to do the same thing, let's create a new selector that returns a boolean from !!getAdsConversionID() || !!getAdsLinked() instead of doing this three different places 🙂

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As discussed, I've added a selector and re-used it in both places. Please let me know if this looks good now, thanks!

@nfmohit
Copy link
Collaborator Author

nfmohit commented Mar 29, 2024

Looks good, just one idea for a small improvement before we merge.

Addressed, thank you for the kind review, @tofumatt!

@nfmohit nfmohit requested a review from tofumatt March 29, 2024 20:51
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.

Looks good, just one thought occurred to me about handling potential loading states, then we're good. 👍🏻

const { getAdsConversionID, getAdsLinked } =
select( MODULES_ANALYTICS_4 );

return !! getAdsConversionID() || !! getAdsLinked();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, one question I just thought of: should we be returning undefined from here if these selectors are still loading? Right now undefined would return false, but that might cause this to go from a "false" to "true" state during loading, which isn't expected. 🤔

I don't think it affects any current components, but it might trip us up in the future. Can you add some undefined handling here? (Unless it isn't needed.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree. I have updated the selector to return undefined if any of these two selectors return undefined.

You're right. I also don't think this affects any current components, as a result, I haven't added any loading state into them. But please let me know if I should do so instead.

Please let me know if this looks good now, thank you!

@nfmohit
Copy link
Collaborator Author

nfmohit commented Apr 1, 2024

Looks good, just one thought occurred to me about handling potential loading states, then we're good. 👍🏻

Addressed, thank you Matt!

@nfmohit nfmohit requested a review from tofumatt April 1, 2024 09:34
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.

Awesome, thanks for adding the test too 😄

@tofumatt tofumatt merged commit 266daf0 into develop Apr 1, 2024
27 of 28 checks passed
@tofumatt tofumatt deleted the enhancement/#8382-cmo-ads-linked branch April 1, 2024 14:40
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