ApiUrl and Overlay

Hi there,
I need to set the ApiUrl in my website snippet because i don’t have the API exposed to the internet.
The Overlay plugin don’t work because (and is documented) they try to load the api using the TrackerUrl.

var _paq = _paq || ;
_paq.push([‘setAPIUrl’, ‘https://internalApi.mydomain.com/’]);
_paq.push([‘trackPageView’]);
_paq.push([‘enableLinkTracking’]);
(function() {
var u=‘//external.mydomain.com/pwa/’;
_paq.push([‘setTrackerUrl’, u+‘piwik.php’]);
_paq.push([‘setSiteId’, ‘23’]);
var d=document, g=d.createElement(‘script’), s=d.getElementsByTagName(‘script’)[0]; g.type=‘text/javascript’;
g.defer=true; g.async=true; g.src=u+‘piwik.js’; s.parentNode.insertBefore(g,s);
})();

But after setting the ApiUrl the Overlay plugin don’t assume the api url (https://internalApi.mydomain.com/) and try to load the api from the TrackerUrl (//external.mydomain.com/pwa/).

Locking for the browser console i get this erros:
Uncaught ReferenceError: Piwik_Overlay_Client is not defined
at HTMLScriptElement. (piwik.js:41)

(https://external.mydomain.com/pwa//piwik.js)

What is wrong? Any ideia?

Thanks,
TP