Problem with variable

Hi I’ve made this code, it does’nt seems to work :
var _paq = _paq || [];
_paq.push([“setCookieDomain”, “*.URLs: http”]);
// you can set up to 5 custom variables for each visitor
// Recupérer le nom de l’utilisateur JDE
var USERJDE=document.getElementById(“User”).value ;
_paq.push([“setCustomVariable”, 1, “NOM”, “USERJDE”, “visit”]);
_paq.push([‘trackPageView’]);
_paq.push([‘enableLinkTracking’]);
(function() {
var u="//serverocs/piwik/";
_paq.push([‘setTrackerUrl’, u+‘piwik.php’]);
_paq.push([‘setSiteId’, 1]);
var d=document, g=d.createElement(‘script’), s=d.getElementsByTagName(‘script’)[0];
g.type=‘text/javascript’; g.async=true; g.defer=true; g.src=u+‘piwik.js’; s.parentNode.insertBefore(g,s);
})();

I don’t see anything in my variable. Where am i wrong?

My question about this :
setCustomVariable(index, name, value, scope = “page”)
Can we put a result of a variable in the value parameter?
Like this?
var APPJDE=document.getElementById(“formOID”);
_paq.push([“setCustomVariable”, 2, “NOMAPP”, APPJDE.innertHTML, “page”]);

Hi there,

Sure it’s possible to put the variable.

If you need help to debug, you can also try this guide: Tracking HTTP API: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3