TemperStack
Beginner8 min readUpdated Mar 18, 2026

How to connect Google Tag Manager on Hostinger

Quick Answer

Connect Google Tag Manager to your Hostinger-hosted website by adding the GTM container code to your site's header and body sections. This can be done through the file manager, WordPress admin, or Hostinger's website builder depending on your setup.

Prerequisites

  1. Active Hostinger hosting account
  2. Google Tag Manager account
  3. Website already hosted on Hostinger
  4. Access to your website's HTML files or WordPress admin
1

Create Google Tag Manager Container

Log into your Google Tag Manager account at tagmanager.google.com and click Create Account or select an existing account. Enter your website name as the Container name, select Web as the target platform, and click Create. You'll receive two code snippets that need to be added to your website.
Tip
Save the GTM container ID (GTM-XXXXXX) as you'll need it for verification later.
2

Access Hostinger Control Panel

Log into your Hostinger account and navigate to the Hosting section. Select the domain where you want to install Google Tag Manager and click Manage. This will open your hosting control panel where you can access your website files.
3

Open File Manager

In your Hostinger control panel, locate and click on File Manager in the Files section. Navigate to the public_html folder (or your website's root directory). Look for your main HTML files or WordPress theme files depending on your website type.
Tip
Always create a backup of your files before making any changes.
4

Add GTM Head Code

Locate your website's main template file (usually index.html or header.php for WordPress). Right-click and select Edit. Find the opening <head> tag and paste the first GTM code snippet immediately after it. Save the file by clicking Save & Close.
Tip
For WordPress sites, edit the header.php file in your active theme folder at /public_html/wp-content/themes/your-theme-name/
5

Add GTM Body Code

In the same file or template, locate the opening <body> tag. Paste the second GTM code snippet (the noscript version) immediately after the <body> tag. Save the file again to ensure both code snippets are properly installed.
Tip
The body code should be the first element inside the body tag for optimal tracking.
6

Verify Installation Using Preview Mode

Return to your Google Tag Manager dashboard and click Preview in the top right corner. Enter your website URL in the preview window and click Connect. Visit your website in a new tab to see if the GTM debug console appears at the bottom of the page.
7

Publish GTM Container

Once verification is successful, return to GTM and click Submit to publish your container. Add a Version name like "Initial GTM Setup" and click Publish. Your Google Tag Manager is now live and ready to manage tracking codes on your Hostinger website.
Tip
Always test your tags in preview mode before publishing to avoid tracking issues.

Troubleshooting

GTM preview mode shows 'No container found'
Check that both GTM code snippets are correctly placed in the <head> and <body> sections. Clear your browser cache and try again with an incognito window.
Cannot edit files in File Manager
Ensure you have the correct file permissions set to 644 for files and 755 for folders. Contact Hostinger support if you're still unable to edit files.
WordPress site breaks after adding GTM code
Remove the code from header.php and instead use a WordPress plugin like Google Tag Manager for WordPress or add the code through Appearance > Theme Editor in WordPress admin.
GTM tags not firing on all pages
Verify that the GTM code is added to your main template file that's used across all pages. For WordPress, ensure you're editing the active theme's header.php file.

Related Guides

More Hostinger Tutorials

Other Tool Tutorials

Ready to get started with Hostinger?

Put this tutorial into practice. Visit Hostinger and follow the steps above.

Visit Hostinger