how to add GTM

How to Add a Google Tag to a Website (GA4 and GTM)

Content updated:

A Google tag sends measurement data to Google products such as Google Analytics 4 (GA4) and Google Ads. Google Tag Manager (GTM) is a separate container system for managing tags. A Google tag ID often begins with G- (for GA4); a Tag Manager container ID begins with GTM-. Copying a GTM container snippet does not automatically create or configure a GA4 tag.

Before Installing: Check for an Existing Tag

If your website already uses a WordPress analytics plugin, Google Site Kit, GTM or a theme integration, check whether the Google tag is already installed. Adding the same page-view measurement a second time can inflate reports. Google recommends one configured implementation rather than overlapping installations.

Method 1: Add a Google Tag with WordPress or a CMS

  1. Sign in to your Google Analytics property and open Admin → Data streams; select your web data stream.
  2. Open the tag installation instructions and choose the supported WordPress or CMS method.
  3. If you use Google’s Site Kit for WordPress, follow its guided connection instead of pasting a second tracking script into your theme.
  4. Use Google Tag Assistant or the Google Analytics Realtime report to verify data arrives; allow some time for events to appear.

Method 2: Install the Google Tag Manually

  1. In Google Analytics, open your web stream’s View tag instructions → Install manually.
  2. Copy Google’s complete, current tag snippet for your own property. Do not copy an example containing another site’s ID.
  3. Add it to the site’s global header immediately after the opening <head> tag, so it loads on every relevant page—not only one page of a multi-page site.
  4. Publish your CMS or site changes and use Google’s testing tool to confirm measurement.

For a maintained WordPress site, prefer a supported integration or managed code-insertion method over directly editing theme files; theme updates can overwrite manual modifications.

Method 3: Install with Google Tag Manager

  1. Create a GTM account and a web container at tagmanager.google.com.
  2. Install the container snippets Google provides for your GTM- ID, using the placement instructions shown in the container.
  3. In GTM, select Tags → New → Google Tag and enter your actual Google tag ID.
  4. Set the appropriate initialization trigger, then use Preview to debug in Tag Assistant.
  5. Select Submit → Publish once events and measurement destinations are verified.

Common Mistakes to Avoid

Do not confuse a GTM- container ID with a G- GA4 measurement ID. Installing GTM alone does not guarantee analytics data collection. Avoid duplicate page-view tags, copying example IDs and editing a theme directly without a backup. Respect applicable consent and privacy requirements before collecting visitor data.

Official Setup and Verification References

Google documents both approaches in its CMS/manual Google-tag instructions, GTM tag configuration guide, and GTM testing and publishing steps. These are more reliable than fixed screenshots because the interface changes over time.