Adding the google analytics code to your wordpress code is very easy, just follow these steps carefully:
1. You need a google account, if you don’t have one, create your free Google Account here.
2. Sign into your google account and go to Google Analytics and click on “Add Website Profile” at the bottom of the page, make sure that “Add a Profile for a new domain “ is ticked and enter the url of the blog/ site you want to analyze and hit finish. You are now presented on the next page with a piece of code. That is your google urchin tracking code. Ok, leave this window open and open a second window in your browser.
Don’t skip the next step!!!!
3. Go to the dashboard of your blog and look for Appearance>Themes>Editor>Templates>Footer (footer.php). Back up your original footer.php by copying and pasting it in a NOTEPAD document. Don’t use word for this, as it may add additional characters to the code. Just open the humble notepad, copy and paste the footer code in your document and save it in case things go wrong. Important! Don’t skip this back-up step!!!!
4. Go back to your google account and copy your analytics code and paste it into the footer.php file, just before the last “</body>” at the end of the page, leaving the rest of the code as it is. Take care not to delete anything, you want to add code, not to remove it! Save your edit. Go to your google account and click “Finish”
Done! If you have followed all steps than you should see now your new web site profile in your google analytics account.
5. It takes some time, up to 24h, until the first data appears. Please be patient 😉
6. In case something went wrong and/ or you want to restore your original footer without the google analytic code, just open your notepad back-up document and copy and paste it into Appearance>Themes>Editor>Templates>Footer (footer.php). Take care to replace the previous code completely.
If you like this blog post and found it helpful, why not share it with your preferred social network? Handy links and bookmarklets above ^^^ 😉