Incorrect username in the dashboard

Hello All,

We have added an application url to Matomo and the issue is when a user tried to access the URL it’s getting registered in Matomo but it’s displaying as Direct user instead of the actual username. Can someone help to fix this issue?

Can someone assist me on this?

Hi @sbollam
What is your tracking code?

Hi @Philippe

Please find the tracking code attached.

<!-- Matomo -->
  var _paq = window._paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  (function() {
    var u="";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '504']);
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
<!-- End Matomo Code -->

Hi @sbollam
In your code, you don’t track user name:

Then you should put _paq.push(['setUserId', 'USER_ID_HERE']); before the trackPageView command.
See also: