Events being tracked as a new visit with a common generic user

Hi Matomo team,

We have an application suite based on the “single-spa” framework wherein we’ve been trying to implement event tracking using the Tag Manager approach.
I have a simple button that shows an alert on click with id=“btn-1”. All the tags, trigger, and sample configurations have been set up as given in the official docs. Also have the default Matomo tracking code added
However, on clicking the button events are tracked as part of some generic user, while all other actions are tracked properly with the correct logged in user with user id.

The JS tracking code as well as Tag Manager snippet both are added in the application.

Can anyone please help?