Embedding Google Analytics into WordPress Website
Google Analytics is a great tool for understanding and improving your website performance. It is a must have feature for any website. It will allow you to measure your website traffic and its sources; better understand your user audience, their geography, behavior, etc. It is easy to install Google Analytics onto your WordPress website.
There are two simple steps.
1. Get your Tracking Code
You have to have Google Analytics Account, which you can create following the Google Analytics instructions.
Log into your Google Analytics account and select the website for which you need the tracking code.
Click on Admin in the left taskbar, then expand Tracking Info under Property in the middle pane, and click on the Tracking Code:
In the right pane under Website Tracking, locate your tracking code in a box, click on it and copy (Ctrl+C):
2. Paste your Tracking Code into WordPress
Log into your WordPress Dashboard as Administrator and navigate to Appearance → Theme Options:
Under the Theme Options, scroll down and click on Scripts:
Under the Custom Scripts for Header and Footer, in the box under Embeds to header.php ↓, paste (Ctrl-V) your Google Analytics tracking code from the step 1 above:
Click the Save Options button in the bottom of the page.
That is it. You just embedded your Google Analytics tracking code into the header.php file, and now this tracking code will appear on every page of your WordPress website.