How to add Google Analytics to WordPress?
There are a few different ways to add Google Analytics (GA) to WordPress and it will depend on what you want from your GA data.
There are a lot of different plugins available to do this and the best for your needs will depend on what you want from the plugin.
If speed and simplicity is your goal then a plugin like CAOS will enable you to host GA locally, reducing load time on the front-end of your site and helping with PageSpeed scores. You’ll need to view stats on the GA site, though. Upside: Minimal bloat in the database, so better for more restrictive hosting packages.
If you want GA in your WordPress Admin Dashboard so you can see your stats whenever you login to your WordPress site, then plugins like Site Kit by Google or MonsterInsights are probably better bets. You tend to get a bit more bloat along with these as they store info in your database, but if you have a generous hosting package these are good options.
Another way is to manually add the Google Analytics tracking code to your WordPress theme. If you do it this way, you’ll need to use GA to view stats and you won’t get the performance benefits of CAOS, however – it’s one less plugin to worry about.
Installing GA yourself takes a bit of knowledge of coding and hosting. If you are comfortable with FTP, have a Child Theme already running and understand which files to modify, this is an easy process. If not, it’s probably not the approach we would take on a live site.