Update to latest Google charts library version
A new Google charts library version was recently published, however it caused critical JS errors in Site Kit (see #3132), so we ensured to keep using version 49 for now. We should still figure out where these errors are actually coming from in regards to the new version 50 release of the charts library, fix them, and update.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- Site Kit should use version 51 of the Google charts library throughout (both in PHP and JS where version 49 is referenced, this needs to be updated).
- The new version should not result in any JS errors on Site Kit screens where charts are present.
Implementation Brief
- Update the
chartVersionprop on theGoogleChartcomponent - ~~In
Core/Assets.phpchange 49 to 50 in thegooglesitKit-google-chartsScriptobject~~ - Remove the
googlesitkit-google-chartsScriptinstance and references to it
Test Coverage
- n/a
Visual Regression Changes
- Check visual tests but no changes are anticipated
QA Brief
- There should be no changes to the Charts.
- Go through Site Kit and check as many charts as possible.
Changelog entry
- N/A
I've created a PR: https://github.com/google/site-kit-wp/pull/3334
All tests pass without any problem* and I cannot display any error while navigating the plugin.
I'm not sure if some specific data was triggering the error though or it crashed all the time. The comments imply the latter, if that's true then Google charts must have released some minor/patch bug fixes, but the JS file doesn't imply that. It's just hosted at https://www.gstatic.com/charts/50/js/jsapi_compiled_corechart_module.js
*except the known failing e2e WP 4.9
Whilst looking into this I found that I can cause the same errors to occur ( as noted in #3132 ) by setting the Google Charts version in Assets.php to 50 and the chartVersion in the GoogleChart component to 49.
The following scenarios work:
Assets.php: 50,GoogleChart: 50Assets.php: current,GoogleChart: 50Assets.php: 50,GoogleChart: removechartVersionpropAssets.php: current,GoogleChart: removechartVersionprop
I shall update the IB with the third of these scenarios.
@Hazlitte would it be possible to add an estimate here now the IB is completed please?
IB :heavy_check_mark:
I'm getting some very odd errors in storybook that free failing on a v51 of google charts :thinking: (Which we aren't loading!) https://www.gstatic.com/charts/51/js/jsapi_compiled_default_module.js
In .storybook/preview-head.html I've updated the version to 50 (which isn't in the IB)
See the version 50 upgrade PR here https://github.com/google/site-kit-wp/pull/3334 and how it fails the VRT and Storybook Test steps (Storybook crashes with errors like this)

However I created a PR with Google Charts upgraded to v51 and those tests pass https://github.com/google/site-kit-wp/pull/3881
Just the PHP Tests / PHP (PHP 7.4, WordPress Nightly) (pull_request) test is failing in both PRs. Seems odd though that the PHP tests only fail for one specific version - I'll check if there's some other issue here by making a new PR with no changes
Failing PHP test is happening on new PRs that only have comment changes - https://github.com/google/site-kit-wp/pull/3882/checks?check_run_id=3343479892 - not related to this PR then
Failing PHP test has now been fixed :+1:
No rush on this but a few questions for @felixarntz in the review.
@aaemnnosttv I think I already replied to them but then forgot to reassign the issue, at least I don't see any other questions. Just to confirm, is #3881 the correct PR? Asking since there's also #3334.
**QA ✅ **
Ran regression tests on Adsense, Search Console and Adsense.

Sending to Approval