There are many ways suggested on the internet to install google analytics code on wordpress blog and I would like to clear my doubts.
When I copy the analytics code to the footer.php
- Will this be available for all pages & post?
- after theme update, will the custom analytics code still remain
What is the advantage of using google tag manager?
Which is the best way and why?
3 Answers
Since your question is about installing the google analytics code in WordPress, I will highly recommend you to install the UA-XXXXXX-X tracking code before the closing head tag “</head>
“. Just edit the theme header.php file.
You don’t need to create a child theme unless you are using someone else’s theme that could potentialy be updated or ask you for an update from which your tracking code will be deleted.