I am using PIWIK 2.1.0 to track users accessing a Sharepoint 2013 Foundation Server.
I am using http://googleanalytics365.codeplex.com/ to add the default webcode to every page which with the default tracking code work perfectly.
I want to collect the userID as a custom variable.
var userID = _spPageContextInfo.userId; gives the user ID and
_paq.push([“setCustomVariable”, 1, “UserID”, Userid, “visit”]); sends the variable
My problem is that often the tracking code fails when this custom variable code is added, not always but often and especially over slow connections.
Have people come across this before? Is there a recognized solution that either delays the code running or checks the variable is defined and if not runs the code without the custom variable to avoid the code stalling in order to get more accurate stats?