Matomo two unique visitor recorded for a single user for visit and events separately

I have added two pieces of code to my website :

  1. Matomo Javascript code
  2. Matomo Tag Manager code (1 Variable & 3 Triggers)

Position of the tracking code places on the html file :

<tag-manager code>

Usually when a user visits the page their Visit Actions and Events should come under a single user like

But in my case there are two separate unique users entry created for Visit Action and Events respectively for a single user click a page :

The problem is Matomo captures the visit actions under a user and events under another user.

@Praz_Solver Do you have a Matomo Tag in the tag manager container configured? If so, it may be expected that you end up having two different visits. Ideally, we would get a URL to reproduce the issue. Usually you would be only tracking through Tag Manager or through the tracking code. Maybe you can tell us a bit more what tracking code you are using, what you have configured in the tracking code and why you are using both.

if you have motomo tag in the manager then it’ll occurs sometimes. please check again that you put the code correctly or checkout the site for more information: JavaScript Tracking Client: Integrate - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3