Using Tag Manager
From Joomla! Documentation
What is the Google Tag Manager?
The Google Tag Manager is a way to combine all your tracking and marketing scripts into one, version-controlled container which is inserted into your site, calling a single file instead of multiple files that can slow your site down.
It also allows you to fire specific tags—such as conversion tags—on specific pages, without having to edit the code of the component or extension that powers the page.
Configuring the Google Tag Manager
Before you can use the Google Tag Manager you must sign up.
Once you have a Google Tag Manager account, you'll log in and see the dashboard from which you can create a new account.
Generally you should create a new account for each client you work with. One account can have multiple containers and many users with these levels of access:
- View only
- View and edit
- View, edit, delete and publish
Installing Tag Manager on Your Joomla Website
Inserting Google Tag Manager into your website requires either editing your template file or using an extension to insert the container in the correct location.
There are pros and cons for both approaches. Inserting into the template requires you to edit the code of the index.php file. However it means it's not easy to remove or unpublish accidentally. Using a plugin requires an additional call on page load, and can potentially have compatibility issues if code changes are necessary.
Google Tag Manager Extensions
There are several extensions you can use to embed the Google Tag Manager code. Browse them on the Joomla! Extensions Directory™.