Web Development

Where to Put Google Tag Manager Code in Google Sites: Complete Installation Guide

Where to Put Google Tag Manager Code in Google Sites: Complete Installation Guide

Social Swarm Marketing Blog

Feb 22, 2026

Where to Put Google Tag Manager Code in Google Sites: Complete Installation Guide

Setting up Google Tag Manager on Google Sites requires precise placement of your container code. Unlike traditional websites where you have full HTML access, Google Sites operates within specific constraints that make GTM installation different from platforms like WordPress or Webflow. If you are wondering where to put Google Tag Manager code in Google Sites, this guide walks you through the exact process.

Many marketers and business owners struggle with this setup because Google Sites does not provide direct access to the head and body tags where GTM code typically lives. However, with the right approach, you can still implement tracking, analytics, and marketing tags on your Google Site. The method involves using custom HTML embeds and understanding how Google Sites processes external scripts.

Understanding Google Sites Limitations

Before diving into the installation steps, you need to understand why standard GTM installation does not work on Google Sites. Traditional websites allow you to paste the GTM container snippet directly into the HTML head and opening body tags. Google Sites, as a closed platform, restricts this level of access for security and stability reasons.

This limitation means you cannot use the standard two-part GTM code snippet that Google Tag Manager provides. Instead, you need an alternative approach that leverages the Embed feature within Google Sites. While this method has some constraints compared to full GTM implementation, it still enables essential tracking functionality for most use cases.

Preparing Your Google Tag Manager Container

Start by setting up your GTM container if you have not already. Log into Google Tag Manager and create a new container for your website. During setup, select Web as your target platform. Once created, Google Tag Manager displays the standard installation code, but you will not use this directly for Google Sites.

Instead of copying the full snippet, you need to note your GTM Container ID. This ID appears at the top of your workspace and follows the format GTM-XXXXXX. Write this down as you will need it for the custom implementation. Do not worry about the code snippet displayed during setup since you cannot use it verbatim on Google Sites.

Step-by-Step Installation Process

Step 1: Access Your Google Site Editor

Open the Google Site where you want to install Google Tag Manager. Click the Edit button to enter editing mode. You need editing permissions for the site to complete this installation. Navigate to the page where you want to add tracking, or plan to add it to multiple pages if needed.

Step 2: Insert an Embed Block

Click the Insert menu in the right sidebar and select Embed. This opens a dialog box where you can add custom HTML code. Choose the Embed code option rather than embedding a URL. This embed functionality becomes the vehicle for your Google Tag Manager implementation on Google Sites.

Step 3: Add the Modified GTM Code

In the embed code box, paste a modified version of your GTM container code. Since Google Sites restricts certain script types, you need to use an iframe-based approach or the Google Tag Manager API loaded through an approved method. The most reliable approach uses the following code structure:

Replace GTM-XXXXXX with your actual container ID. This code creates an invisible iframe that loads your GTM container when visitors access your site. While not as robust as standard GTM installation, this method supports most common tracking tags including Google Analytics, Facebook Pixel, and conversion tracking.

Step 4: Position the Embed Element

Resize the embed block to make it as small as possible, typically 1 pixel by 1 pixel, and position it in an unobtrusive location on your page. Many users place it in the footer area. The embed must remain visible on the page for the script to execute properly, so do not hide it completely or place it where it might be deleted accidentally.

Step 5: Publish Your Changes

Click Publish to make your changes live. Google Tag Manager will not work in preview mode, so you must publish the site to test your installation. After publishing, visit your live site and verify that the GTM container loads correctly using Google Tag Assistant or by checking your GTM preview mode.

Testing Your Google Tag Manager Installation

After installation, thorough testing ensures everything works correctly. Open your published Google Site in a new browser tab. Install the Google Tag Assistant Chrome extension and enable it for your site. The extension should detect your GTM container and display your container ID if the installation succeeded.

Enter preview mode in Google Tag Manager and refresh your Google Site. You should see the debug panel appear at the bottom of your screen, confirming that GTM is firing correctly. Test individual tags by triggering the events they are configured to track. Common tests include page view tracking, button clicks, and form submissions.

Working with Tags and Triggers

Once GTM is installed, you can add various tags to track user behavior. Google Analytics 4 configuration tags work well with this setup and capture standard page view data. Conversion tracking tags from Google Ads also function properly. However, some advanced GTM features have limitations on Google Sites due to the embed-based installation method.

Create triggers based on the available interaction types. Page view triggers work automatically. For click tracking, you may need to add specific classes or IDs to buttons and links within Google Sites, then configure click triggers in GTM to target those elements. Scroll tracking and timer triggers also function normally with this implementation.

Troubleshooting Common Issues

If Google Tag Assistant does not detect your container, double-check that you replaced the placeholder container ID with your actual GTM ID. Verify the site is published and you are viewing the live version, not the editor preview. Clear your browser cache and cookies, then test again.

When tags fire in preview mode but do not record data in your analytics platform, check your tag configuration. Ensure tracking IDs are correct and match your analytics accounts. Some ad blockers prevent GTM from loading, so test with blockers disabled or use a different browser.

If the embed block disappears or stops working, Google Sites may have removed it during an edit. Check that the embed remains on your page and republish if necessary. Avoid placing multiple GTM embeds on the same page as this can cause conflicts.

Alternative Tracking Methods

If the embed method does not meet your tracking needs, consider alternatives. Google Sites offers native Google Analytics integration through the Settings menu, which provides basic tracking without GTM complexity. For simple page view tracking, this native integration often suffices.

For more advanced tracking requirements, consider migrating to a platform with full GTM support like Webflow, WordPress, or a custom-built website. These platforms allow standard GTM installation and unlock the full feature set of Google Tag Manager without workarounds.

Maintaining Your GTM Setup

After successful installation, maintain your Google Tag Manager setup by regularly testing your tags. When you add new pages to your Google Site, remember to include the GTM embed on those pages as well. The embed does not automatically propagate across your entire site unless you add it to each page individually or place it in a shared header/footer element.

Keep your GTM container organized by naming tags and triggers clearly. Document your setup so team members understand what each tag tracks. Regular audits of your container prevent tag bloat and ensure accurate data collection.

Conclusion

Knowing where to put Google Tag Manager code in Google Sites opens up powerful tracking capabilities for your website. While the platform requires a modified approach compared to traditional websites, the embed method provides reliable tag management for most marketing and analytics needs.

Follow the steps outlined in this guide to install GTM correctly, test thoroughly using Google Tag Assistant, and maintain your setup as your site evolves. With proper implementation, you will gain valuable insights into visitor behavior and can optimize your Google Site for better performance and conversions.

If you need help setting up Google Tag Manager on your Google Site or want to explore more advanced tracking solutions, our team specializes in analytics implementation and can ensure your tracking setup captures the data that matters most to your business.

About the Author

Collin Johnson is a web designer, marketer, and owner of Social Swarm Marketing with over seven years of experience building fast, conversion-focused websites. His work emphasizes performance, clarity, and sustainable growth, helping businesses and founders create online presences that load quickly, rank well, and drive results.

Collin D Johnson

Founder, Marketer, Designer

About the Author

Collin Johnson is a web designer, marketer, and owner of Social Swarm Marketing with over seven years of experience building fast, conversion-focused websites. His work emphasizes performance, clarity, and sustainable growth, helping businesses and founders create online presences that load quickly, rank well, and drive results.

Collin D Johnson

Founder, Marketer, Designer

Let’s Build Something

Whether it’s a cutting-edge design, seamless development, or ongoing support, we’re here to bring your vision to life. Let’s talk and make it happen!

Let’s Build Something

Whether it’s a cutting-edge design, seamless development, or ongoing support, we’re here to bring your vision to life. Let’s talk and make it happen!

Let’s Build Something

Whether it’s a cutting-edge design, seamless development, or ongoing support, we’re here to bring your vision to life. Let’s talk and make it happen!