Internet users with intranet piwik

Piwik is installed on our intranet.
some users dont have internet connections so using the internal ip of piwik in the tracking code allowed us to track all users when working in the company.
however if the user connected to our website from outside the company (using internet), Piwik cant track them. what is the solution for this?

We had a similar issue, but since our “intra-app” requires login, we just switched to tracking by User ID: User ID - Analytics Platform - Matomo

hmm can’t we have something like the javascript tracking code knows if there is internet to go through the internet and other to go using internal ip?