Matomo not tracking/collecting referer?


(Tristan) #1

Hi all

For some odd reason Matomo does not appear to be collecting the referer URL. Using WordPress with WP-PiWiK plugin and the following JS:

<!-- Matomo -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["trackPageView"]);
_paq.push(["enableLinkTracking"]);
_paq.push(['enableHeartBeatTimer']);
function embedTrackingCode() {
    var u="//URL";
   _paq.push(["setTrackerUrl", u+"browse"]);
   _paq.push(["setSiteId", "1"]);

   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+"load.js"; s.parentNode.insertBefore(g,s);    
}

if (window.addEventListener) { 
    window.addEventListener("load", embedTrackingCode, false); 
} else if (window.attachEvent) { 
    window.attachEvent("onload",embedTrackingCode); 
} else {
    embedTrackingCode();
}
</script>
<!-- End Matomo Code -->

And this is what it requests when a referer header is set:

https://URL/browse?action_name=Tabletop&idsite=1&rec=1&r=914652&h=17&m=23&s=18&url=https%3A%2F%2FURL%2F%3F34o83497&_id=1dae7fc2b0470d90&_idts=1550125369&_idvc=1&_idn=0&_refts=0&_viewts=1550125369&send_image=1&pdf=1&qt=0&realp=0&wma=0&dir=0&fla=0&java=0&gears=0&ag=0&cookie=1&res=2560x1440&gt_ms=423&pv_id=Apmobt&nwefftype=4g&webgl=1

Does anyone have any ideas on how to overcome this?

Cheers