Tracking multiple websites - Not Working

Hi, I have a matomo server. Initially i configured for a high traffic site and and added the tag manager code alone in the head portion of the website.Then, I replicated the configuration for another high traffic website and added the tag manager code alone in the head part. Now the number of visits for second website shows correctly where as the first one shows the wrong value. Is there any solution for this?