We are capturing EmployeeID in our web page using piwik custom variable option.
Here is my code,
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);
})();
And execute the following query in mysql to view visit log info.
Query:
SELECT LV.custom_var_v1 AS EmployeeID
, LV.*
FROM piwik_log_visit LV
WHERE LV.idsite=3 AND LV.custom_var_v1 = 123456 ORDER BY LV.idvisit DESC;
But after few minutes the EmployeeID is updated wrongly in piwik_log_visit table’s “custom_var_v1” field with different EmployeeID for the same idvisit.