In previous post you learned about What’s Google Tag Manager? Now, this blog will give you complete information about how to set up Google Tag Manager in WordPress.
Follow the steps below to set up Google Tag Manager in WordPress website:
Step-1: Login to GTM account
Login to your Google Tag Manager account and select the container. Workspace page opens.
Step-2: Copy the both code from GTM
Click GTM code on right hand side of the page. Install Google Tag Manager box opens. This will show 2 codes. First for header and second for body. Now copy both codes.
Step-3: Login WordPress admin panel
Login to word press through WP admin. Select Appearance then click to theme-editor tab.
Step-4: Paste the first code in header.php file
Scroll down and select theme header file (header.php). Theme Header box opens. Paste the header code where the header ends. Click update file.
Step-5: Paste the second code in footer.php file
Go to Theme Editor page, Select Theme Footer (footer.php) in Theme Files section. Theme Footer box opens. Scroll down and paste the Body code where the Body tag ends. Click update file.
Step-6: Check the Google tag manager code in website
Now refresh the website. Press Ctrl + U. The code page opens. You can see the header and body code updated in your WordPress website.