Add Google Analytics to WordPress Without a Plugin
Now that we have the Google Analytics Code, we need to insert it in its new home.
To do this, we first must locate the header.php file. Placing the code in this file ensures that the Google Analytics Code is effective in all WordPress pages on your website.
Open the Dashboard of your WordPress website and go to Appearance and click on the Theme Editor in the submenu.
Once the Theme Editor is open, locate the Header File (header.php) from the list of WordPress files shown on the right of your Dashboard:
The Theme Editor will open and display the Theme Header PHP code held in the header.php file.
With the header.php file open, we can move on to inserting the analytics code in the correct place in the header…