Container Tag Manager code and Tracking code. Are both needed?

Hello

I followed the very good tutorial “3 - Deploy your first Container with Matomo Tag Manager” - https://www.youtube.com/watch?v=sSRZxXJXPrI

I have a simple question. To track Visitors and Events do I need to include both the Tracking code and the Container code in the header of each web page of the site I am monitoring? The example in the tutorial only included the Container code.

Thanks for your feedback

Go to https://yourmatomoserver/index.php?module=CoreAdminHome&action=trackingCodeGenerator&idSite=1 and then you’ll see that you have to choose one code among several :wink:

Thanks for your quick reply.
I had Tracking code which was working and I saw activity in the Visits Log.
I removed this and put in the published Container code in the header instead but now I don’t get anything - no Visits or Events logged.

So all I have now is the Tag manager code in the header. AM I missing something else?

Hi,

If you only add the container code to the site, but still want to use Matomo for tracking (you can also use Tag Manager without the rest of Matomo), you have to add the Matomo Tag to your container.

Ok understood. I added the PageView tag to the container and all Visits are recorded. Thank you