I'm looking for ways to add Google Analytics tracking code in WordPress site. - First of all, I want to place tracking code without the use of any plugins. - My theme has no any such feature pre-installed in theme options/panel. - I know one way - Adding tracking code in header.php before </head>. But after each theme update it's gone and sometimes I forgot to put tracking code back again and I miss data in GA. Is there any other way you guys are using/know, please let me know.
I think you can create external tracking script and add script link in header.php file like as plugin algorithm.or you can also disable update theme for avoiding update fast repeatedly.
I'm not personally aware of a way to do that without re-editing after every update unless you use a plugin.
You can add widget with code at the end of your footer. It worked earlier for me. I'm not sure if it works now.
Paste the tracking code in the footer part is the old way to add tracking code to the website. How to add it? Go to your DashBoard Go to Appearance Section Click on Editor Click on header.php file below the templates section Paste it after the <body> tag. <body <?php body_class (); ?>> Paste Analytics code here <script> -------- -------- ------ </script> Code ended here Code (markup): Don't Forget to take BackUp first. Hope this will help you.
But in this way, we need to add tracking code again after updating the theme. That's what I don't want to do.
If after updating there is need to add it again so I recommend you to install the plugin for the same.
Yes, I think it's the only way to do that. Anyways, thanks for your help and taking time to provide steps. Have a great buddy!
On our website we use a plugin called "Insert headers and footer" by WPbeginner. And in it we just place the Google Analytics and the Google Tag Manager code. The plugin and Google Analytics were installed by the Analytics Help agency that manages our Google Analytics install.
Hello, Hope you are doing well. These are the Ways to place Google analytics tracking Code in WordPress Site - Put your google analytics code in header.php between <head> and </head> tag. - Another way is to upload analytics code file in hosting