Add Google Tag Manager to WordPress
1. Install and activate a plugin that adds tracking scripts to page headers and footers.
Examples of such plugins are Insert Headers and Footers, Header and Footer Scripts, Head, Footer and post injections, and Head and Footer Scripts Inserter.
2. Open your Google Tag Manager container and click on the code in the top right corner that begins with GTM.
A pop-up window will open with Google Tag Manager container code snippet:
3. Copy the section code and paste it into the head or header field of the WordPress plugin you chose.
4. In GTM, copy the second code snippet , then paste it immediately after the opening of the tag in the WordPress plugin you chose. Click on Save.
5. In GTM, click on Submit at the top right, give your version a name, and click on Publish.
6. Click on Preview in the top right corner of your GTM workspace, type your URL and start previewing your website to test the code.
Your tags should appear. If they don’t, perform the action that should trigger them. For example, filling a form if you’re trying to track form fills.