Before proceeding with this tutorial please note that if you change or update your theme you will have to add the tracking code again.
Login to the Google Analytics website. If you do not have an account you will have to create one. You can also login with your existing Gmail account.
If you have multiple sites attached to your account, select the site which you wish to the add tracking code for. In the case below, click where it says “All Web Site Data“.

Once clicked it will open an expanded menu, select your site then click “Open“.

Click the last item from the left menu, “Admin“.


From the “Admin” dashboard click “Tracking Info“.

Here is the magical code that will keep track of your site’s visitors.
- Click anywhere in the text box and it will automatically highlight all the code for you.
- To copy, either click “Edit” from your browser’s top menu, then “Copy“, or ‘Cmd‘ + ‘C‘ (Mac), or ‘Ctrl‘ + ‘C‘ (PC) from your keyboard.

Now let’s head back to our WordPress dashboard. In the left menu, hover over “Appearance” then click on “Theme Editor“.

On the left, select “Theme Header (header.php)“.

Now paste the Google Analytics code just above the closing </head> tag by performing a ‘Ctrl‘ + ‘V‘ (PC) or ‘Cmd‘ + ‘V‘ (Mac) or ‘Edit‘ then ‘Paste‘ from top browser menu.

You will now see the pasted code below between the blue lines.

Click “Update File” button at bottom.

That’s it! You are done. It may take a day or so for tracking to work.
One thought on “How To Add Google Analytics In Your WordPress Site Without A Plugin”