This code is automatically generated when you create your Google Analytics account and you need to paste it on every page you want to track on your site.
How does it look like?
ga(‘create’, ‘UA-4400xxxx-x’, ‘auto’);
Let’s go through where you will find the code and a few other details you will need from that page.
Where can I find my Google Analytics tracking code?
Login Google Analytics and click on “Admin”:
Select your property and click on “Tracking info” and “Tracking Code”:
and it will take you to the tracking code window. Here you have a couple of things you can use:
- Tracking ID: It tells Google which account and property to send your data to. The first set of numbers indicates the account “000000” and the other “01” indicates the property. The tracking ID needs to be included in the tracking code. You will need it also if you are using the API.
- In this window you can also check if Google is receiving data from your website: “Status: Receiving Data“
- And finally you have the tracking code itself
And that’s it!
Where do I place the Google Analytics code?
A lot of themes come with a placeholder for the google analytics code:
or if you don’t have a theme that supports this, you need to locate your header.php file in your wordpress.org installation and at the end of the file, copy the code and click update file.