There are a couple of ways to add Google Analytics to WordPress using the code snippet. Sometimes the easiest solution is to just add another plugin. While that may do exactly what you want, it can also come with more ads on your dashboard but more importantly, you can’t be sure what it’s really doing.
So, with that in mind, I am going to walk you through the quickest way to add Google Analytics to your theme.
Where to start
We’re going to add our Google Analytics tracking code to your themes functions.php file. We will create a new function that contains the code snippet provided by Google.
- You can either open your themes functions file through the admin (Appearance -> Theme Editor) or open the file using a text/code editor. If you’re not a developer/familiar with SSH/FTP then the first option may be for you, otherwise just reach out to someone who can help with this part.
- Next, just copy the snippet below and paste it into the end end of that file.
- Now all you need to do is save your changes and that’s it!