-
-
- Submit Updated Articles to Bing and Yandex with IndexNow in Joomla
- Add Published and Modified Date Meta Tags to Joomla
- Add Open Graph and Twitter Card Tags to Joomla
- Auto-Generate Meta Descriptions from Article Text in Joomla
- Add Noindex to Specific Pages in Joomla
- Verify Your Joomla Site with Google Search Console
-
- Add a View as Markdown Link to Joomla Articles
- Display the Last Modified Date in Joomla Articles
- Embed Iframes in Joomla
- Automatically Link Twitter (X) @mentions in Joomla Articles
- Open External Links in a New Tab in Joomla
- Display Estimated Reading Time in Joomla Articles
- Replace Old URLs in Joomla
- Search and Replace in Joomla
-
- Add a Footer Line to the Joomla Administrator
- Show a Staging Banner in the Joomla Administrator
- Remove the "All" Option from Admin List Limits in Joomla
- Add a Cookie Consent Banner to Joomla
- Make the Administrator Navigation Sticky in Joomla
- Add Google Fonts to Joomla
- Add a Facebook Messenger Chat Button to Joomla
- Add a Reading Progress Bar to Joomla
- Add a Custom Scrollbar to Joomla
- Show Confetti on a Thank You Page in Joomla
- Add Smooth Scrolling to Joomla
- Add a Back to Top Button in Joomla
- Add a WhatsApp Chat Button in Joomla
-
- Protect the Administrator with a Secret URL Key in Joomla
- Show a Welcome Message on First Login in Joomla
- Log Out Idle Administrators in Joomla
- Assign New Users to a Different User Group Automatically in Joomla
- Redirect Visitors by Country in Joomla
- Redirect Users After Login by User Group in Joomla
- Block User Registration with Certain Usernames in Joomla
- Block User Registration by Country in Joomla
- Block User Registration by Email Address in Joomla
- Block User Registration by IP Address in Joomla
- Remove the Forgot Password and Username Links in Joomla
- Remove the Generator Meta Tag in Joomla
- Let Users Log In with Their Email Address in Joomla
- Block Traffic by Country in Joomla
- Block Bot Traffic in Joomla
- Block Traffic by IP Address in Joomla
Add Google Tag Manager to Joomla
Manage all your tracking tags from one dashboard by adding Google Tag Manager to your Joomla site once, using 2 HTML snippets.
Every marketing tool you try wants its own tracking code in your site's head: analytics, ad pixels, heatmaps, chat widgets. Each one means another trip into your template or another plugin. Google Tag Manager replaces them all with one container that you manage from Google's dashboard. You can add Google Tag Manager to Joomla with 2 HTML snippets in Code Snippets.
Get your container ID
You need a Google account.
- Go to Google Tag Manager and sign in.
- Click Create Account, or open an existing account.
- Enter an account name and a container name, and choose Web as the target platform.
- Accept the terms of service. Tag Manager shows you the install code.
- Copy your Container ID. It looks like
GTM-XXXXXXX.
The snippet code
Google Tag Manager needs 2 pieces of code, so you'll create 2 snippets. The first is a script for the <head>:
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
The second is a fallback for visitors without JavaScript, which goes right after the opening <body> tag:
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
How to add the snippets
Snippet 1: the head code
- Install Code Snippets if it isn't installed already.
- Log into your Joomla backend.
- Go to Components → Tassos Code Snippets.
- Click New.
- Enter a title, for example Google Tag Manager head.
- Set Code Type to HTML.
- Set Insertion Method to Auto-Insert Locations.
- Set Location to Site Header.
- Paste the head code above into the editor.
- Replace
GTM-XXXXXXXwith your Container ID. - Click Save & Close.
Snippet 2: the body code
- Click New.
- Enter a title, for example Google Tag Manager body.
- Set Code Type to HTML.
- Set Insertion Method to Auto-Insert Locations.
- Set Location to Site Body.
- Paste the body code above into the editor.
- Replace
GTM-XXXXXXXwith your Container ID. - Click Save & Close.
The Site Body location puts the code right after the opening <body> tag, where Google expects it.
Check that it works
- Open your container in Tag Manager and click Preview.
- Enter your site's address and connect.
Tag Assistant shows the container firing on your page, with every tag inside it. You can also view your page source and search for GTM-: you should find both the head script and the body code. If Preview can't connect, check that both snippets are published and that the Container ID matches in both.
To add Google Analytics without Tag Manager, see Add Google Analytics to Joomla. To learn more about how HTML snippets work, read the HTML snippet docs.