How to Insert Google Tag Manager (GTM) Code in WordPress

How to Insert Google Tag Manager (GTM) Code in WordPress

Step 1: Get Your Google Tag Manager Code

  1. Log in to Google Tag Manager.
  2. Create a container for your website.
  3. Copy the two code snippets GTM provides:One for the header section.One for after the opening <body> tag.

Step 2: Insert GTM Code in WordPress

Option 1: Using a Plugin (Easiest Way)

  1. Install a Plugin:From your WordPress dashboard, go to Plugins > Add New.Search for Insert Headers and Footers and install it.
  2. Insert the Code:Go to Settings > Insert Headers and Footers.Paste the first snippet (for the header) into the Scripts in Header box. Paste the second snippet (for after the body) into the Scripts in Body box.Click Save.


Option 2: Manual Method (For Developers)

  1. Add to Header:Go to Appearance > Theme File Editor.Find header.php and paste the first snippet right before </head>.
  2. Add After Body:In the same header.php file, find the <body> tag.Paste the second snippet immediately after <body>.

Step 3: Test It

Use the Tag Assistant Chrome Extension to check if your GTM code is working.

要查看或添加评论,请登录

Aqib Hameed的更多文章

社区洞察

其他会员也浏览了