Hi there,
How can I add google analytics code MANUALLY in the footer (or header) without using a plugin?
In the Dashbord / Design / Editor I have only access to the (child) style.css. No access to footer.php or header.php …
I’m an absolutely wordpress newbie, so this question is also for better understanding how the child theme is working.
Thanks for your help
Hi Jürgen
First of all ensure that you have a WordPress Admin Access/Account.
Copy the tracking code. Go to your WordPress Admin and then Appearance > Editor.
Open your theme’s header.php file and directory underneath the tag, paste the tracking code. Click “Update File”.
That’s all that is required.
To confirm that it is working, go back to your Google Analytics account. Click on “Admin” at the top of the page and under “Property” choose your site and then click “Tracking Info”.
If the Tracking Status is “Receiving Data,” then you have successfully added Google Analytics to your site.
Cheers
Thanks.
Meanwhile I figured out that I first have to copy the header.php and footer.php from the main theme into my child theme folder. Then I can edit the footer or header.php as discribed. Thank you Addo.
Bye
Hi Jürgen
Super, glad that did the trick.
If you decide you want to go the plugin route I quite like this plugin:
https://wordpress.org/plugins/googleanalytics/
It’s super simple, just one field for your tracking ID.
All the best.
You have correctly pointed out the steps to add google analytics code to theme, but if theme is upgraded user have to do it again so its better to add by creating a simple plugin. You can refer http://techosaurs.com/how-to-add-google-analytics-to-wordpress/ for steps on how to add google analytics code using a simple plugin.