Error in piwik.js function logEvent

(hamburger) #1

if you call the function

logEvent(category, action, name, value, customData, callback)

without parameter it shout gives an error.

(logConsoleError(‘Error while logging event: Parameters category and action must not be empty or filled with whitespaces’);

But it doesn’t. Because the line


returns 9 (the length of the word categorie) when categorie is empty
So the error will never been showed.

var category;
console.log(“String(category)).length:”,String(category).length); // gives String(category)).length: 9

testes in firefox 61.01 and windows 7

(Lukas Winkler) #2


You are right. This is probably a bug and you should report it on Github.

Minor Nitpick: String(category).length returns 9 but this is not the length of categorie, but rather the length of String(category) which is "undefined" if category is not defined.