This PR is based off of #18429.
Changes:
@sgiehl updated
@peterhashair I don't see this failure in https://app.travis-ci.com/github/matomo-org/matomo/builds/243453117 can you link to it?
@peterhashair nevermind, I see it now.
@diosmosis seems to work in general. But I got this JS error when a report page is loaded:
@sgiehl fixed that