Piwik modifies URL of anchor element

I added the standard tracker code below to track content interaction. I noticed the URL of the anchor element is updated to href=“https://myPiwikHost/piwik/piwik.php?redirecturl=…”. As a result, if our on-premise Piwik is offline, the links won’t work on our pages.

The behavior is not consistent. On IE and Firefox I don’t see the anchor element being updated. I have another application with the same tracking code. The anchor element there is not updated.

Is there anything I did wrong?


        var _paq = _paq || [];
        _paq.push(['setCustomUrl', location.href.toLowerCase()]);
        _paq.push(['setUserId', 'myId']);

        (function () {
            _paq.push(['setTrackerUrl', "https://myPiwikHost/piwik/" + "piwik.php"]);
            _paq.push(['setSiteId', 74]);
            var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
            g.type = 'text/javascript'; g.async = true; g.defer = true; g.src = "https://myPiwikHost/piwik/" + 'piwik.js'; s.parentNode.insertBefore(g, s);

I notice in piwik.js there is a function replaceHrefsIfInternalLink() that seems to update href of anchor element. I don’t know enough to tell when it’s being called.

Any help is appreciated.