function matomo(userId) {
let userId=localStorage.getItem('userEmail');
console.log("matomo",userId);
var _mtm = (window._mtm = window._mtm || []);
// var _paq = window._paq = window._paq || [];
_mtm.push(["trackPageView"]);
_mtm.push(["enableLinkTracking"]);
_mtm.push(["trackAllContentImpressions"]);
_mtm.push({
"mtm.startTime": new Date().getTime(),
event: "mtm.Start",
uid: userId,
});
(function () {
var d = document,
g = d.createElement("script"),
s = d.getElementsByTagName("script")[0];
g.async = true;
g.src = "";
s.parentNode.insertBefore(g, s);
})();
}
We have used this code for tracking userId of logged in user in Angular Project.We are getting userId in console everytime.But in matomo all userId is not saved.What is the issue ?