Sometimes user's visits are not getting tracked in piwik


#1

Some users visits are not getting tracked in piwik. I asked some users to open the web page and parallely I am checking whether the visit log is stored in piwik database. But the visits are missing to some of the EmployeeID’s.

Here is the piwik Async. call code which is used in my web page,

var _paq = _paq || [];
(function () {
var u = ((“https:” == document.location.protocol) ? “URL” : “URL”;
_paq.push([‘setSiteId’, ‘3’]);
_paq.push([‘setTrackerUrl’, u + ‘piwik.php’]);
_paq.push([‘setCustomVariable’, ‘1’, ‘EmployeeID’, ‘123456’, ‘visit’]);
_paq.push([function () {
var customVariable = this.getCustomVariable(1);
} ]);

_paq.push([‘trackPageView’]);
_paq.push([‘enableLinkTracking’]);

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);
})();


(Matthieu Aubry) #2

You can safely remove


_paq.push([function () {
var customVariable = this.getCustomVariable(1);
} ]);

otherwise it looks OK to me, maybe see Troubleshooting - Analytics Platform - Matomo