As several others, I am experiencing similar problems when using both Tag manager and the basic analytics code.
I tried the solution to remove the basic tag and instead use the tag manager code snippet in the html. Unfortunately this resulted in less data being tracked. I also noticed that when using the Tag manager code snippet, I got several hundreds pageviews on “Page Name not defined”. Basically, even though I want to use Tag manager, it is not worth all the problems generated from removing the basic code snippet. I do recall that when using Google Analytics you are usually only using the tag manager code and it does not effect the collected data. Should Matomo work the same way?
I tried adding the basic analytics code in a custom html tag, but no luck. Still get the “page Name not defined”.
Any tips on resolving the issue? Tag manager is an important feature, would be a shame not to use it.