In order to install the Google Tag Manager (GTM) on Wordpress websites, follow the steps below:
Step 01: Select the Appearance area, on the menu on the left.
Step 02: Select the Theme Editor section. If you don't see the Theme Editor option, you are not a page administrator, and thus, can't do that by yourself. Ask the owner for Administrator access, or show this article to the administrator.
Step 03: On the editor page you will see a list of template files on the right side of the page. Click on the one called header.php.
If this step isn't possible, it may be because some templates do not allow this action or use a different name for the file. In this case, try selecting the files in your theme template responsible for generating the headers and navigation on your website.
Step 04: Once you have opened the header.php file, first add the tracking code in the header section, specifically at the top of the <head> element.
Step 05: Similarly, add the second tracking code to the header section, specifically at the very top of the <body> element.
Step 06: Save the changes as soon as you are done. Due to the nature of theme template files, you need to be careful when making any changes to header.php. Not saving quickly may lead to a broken model and the tracking code malfunctioning.
That said, it is best to make a copy of the file's codes before making any changes to it. That way, if anything goes wrong, you can always restore the original code.