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

Use engagementRate and display it as a percentage. #6690

Merged

Conversation

techanvil
Copy link
Collaborator

Summary

As discussed on Slack we need to change from using the engagedSessions to the engagementRate metric, and display it as a percentage.

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.

@github-actions
Copy link

github-actions bot commented Mar 6, 2023

Size Change: +7 B (0%)

Total Size: 1.23 MB

Filename Size Change
./dist/assets/js/googlesitekit-modules-analytics-********************.js 73.7 kB +7 B (0%)
ℹ️ View Unchanged
Filename Size
./dist/assets/css/googlesitekit-admin-css-********************.min.css 48.2 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/32-********************.js 3.12 kB
./dist/assets/js/analytics-advanced-tracking-********************.js 769 B
./dist/assets/js/googlesitekit-activation-********************.js 27.1 kB
./dist/assets/js/googlesitekit-adminbar-********************.js 36 kB
./dist/assets/js/googlesitekit-api-********************.js 9.55 kB
./dist/assets/js/googlesitekit-components-gm2-********************.js 5.96 kB
./dist/assets/js/googlesitekit-components-gm3-********************.js 9.73 kB
./dist/assets/js/googlesitekit-data-********************.js 2.15 kB
./dist/assets/js/googlesitekit-datastore-forms-********************.js 9.23 kB
./dist/assets/js/googlesitekit-datastore-location-********************.js 2.09 kB
./dist/assets/js/googlesitekit-datastore-site-********************.js 16.3 kB
./dist/assets/js/googlesitekit-datastore-ui-********************.js 9.32 kB
./dist/assets/js/googlesitekit-datastore-user-********************.js 21.8 kB
./dist/assets/js/googlesitekit-entity-dashboard-********************.js 63.5 kB
./dist/assets/js/googlesitekit-i18n-********************.js 3.92 kB
./dist/assets/js/googlesitekit-main-dashboard-********************.js 69.4 kB
./dist/assets/js/googlesitekit-modules-********************.js 20.5 kB
./dist/assets/js/googlesitekit-modules-adsense-********************.js 68.5 kB
./dist/assets/js/googlesitekit-modules-analytics-4-********************.js 25.1 kB
./dist/assets/js/googlesitekit-modules-optimize-********************.js 18.7 kB
./dist/assets/js/googlesitekit-modules-pagespeed-insights-********************.js 21.1 kB
./dist/assets/js/googlesitekit-modules-search-console-********************.js 41.8 kB
./dist/assets/js/googlesitekit-modules-tagmanager-********************.js 32 kB
./dist/assets/js/googlesitekit-polyfills-********************.js 378 B
./dist/assets/js/googlesitekit-settings-********************.js 51.8 kB
./dist/assets/js/googlesitekit-splash-********************.js 70.5 kB
./dist/assets/js/googlesitekit-user-input-********************.js 44.6 kB
./dist/assets/js/googlesitekit-vendor-********************.js 319 kB
./dist/assets/js/googlesitekit-widgets-********************.js 16.1 kB
./dist/assets/js/googlesitekit-wp-dashboard-********************.js 61 kB
./dist/assets/js/runtime-********************.js 1.26 kB

compressed-size-action

Copy link
Collaborator

@aaemnnosttv aaemnnosttv left a comment

Choose a reason for hiding this comment

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

Thanks @techanvil – just a few small points to address 👍

@@ -43,6 +43,7 @@ const ANALYTICS_4_METRIC_TYPES = {
conversions: 'TYPE_INTEGER',
screenPageViews: 'TYPE_INTEGER',
engagedSessions: 'TYPE_INTEGER',
engagementRate: 'TYPE_INTEGER',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

@techanvil techanvil Mar 6, 2023

Choose a reason for hiding this comment

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

Thanks, I've fixed this on the #6689 branch and cherry-picked the commit here as well.

@@ -188,7 +188,7 @@ function ModulePopularPagesWidgetGA4( props ) {
hideOnMobile: true,
field: 'metricValues.2.value',
Component: ( { fieldValue } ) => (
<span>{ numFmt( fieldValue, { style: 'decimal' } ) }</span>
<span>{ numFmt( Number( fieldValue ) / 100, '%' ) }</span>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we maybe use parseFloat instead?

Also, fieldValue for engagementRate will be a number between 0 and 1 (inclusive) so we shouldn't need to divide by 100.

Copy link
Collaborator Author

@techanvil techanvil Mar 6, 2023

Choose a reason for hiding this comment

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

It doesn't look like we need parseFloat() here, just passing fieldValue in to numFmt() without dividing it, while specifying the % format seems fine.

@techanvil techanvil force-pushed the enhancement/6219-popular-pages-widget-ga4-engagementRate branch from 6a3ba27 to b264e84 Compare March 6, 2023 22:45
Copy link
Collaborator

@aaemnnosttv aaemnnosttv left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@aaemnnosttv aaemnnosttv merged commit 4765abd into develop Mar 7, 2023
@aaemnnosttv aaemnnosttv deleted the enhancement/6219-popular-pages-widget-ga4-engagementRate branch March 7, 2023 04:51
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.

2 participants