Will be better if we change $view->piwikUrl with specific domain
@tinwinaung would you mind trying to explain what problem this change will solve? Is the hostname included not the correct one?
I can see how this might be a problem if
getPiwikUrl is not correct and stored eg as 127.0.0.1 or something. Haven't tested though if it works.
If Matomo is behind a reverse proxy and installed in a sub-path, please follow instructions in https://matomo.org/faq/how-to-install/faq_98/
IMO this change shouldn't be needed if you follow the instructions? please re-open if it's not working and explain the steps you took.