Step for Adding Google analytics code in your website
- Step 1 – Go to Google.com/analytics and login with your gmail account.
- Step 2 – Go to Admin Section and From the First Dropdown in the Account Column Select Create New Account.
- You will be asked to enter details of your new account like Website where you want to track using analytics code.
- Chose your website category accordingly.
- Click on Get Tracking ID and read terms and conditions and continue if you agree.
- You will get a script like this –
ga(‘create’, ‘UA-ABCDEFG-1, ‘auto’);
Here UA-ABCDEFG-1 is your unique google analytics ID. Tracking ID
It can be accessed from your google account only or by any person with whom you share your google analytics data.
- Copy the code provided by GA from Step 6 and open the code of your website.
- Place (Paste in HTML) this code in every page of your website which you want to track. If your website is built using HTML and has pages like Home.html, About.html, Contact.html etc. Then you have to place this code just before the closing body tag of every HTML page.
- If your website is built using a CMS like wordpress then you can place your code in either header.php just before closing header tag OR in footer.php just before closing body tag. In my opinion it is better to have analytics code placed in footer because it helps in analyzing the website performance after the page elements have completely loaded.
Footer.php is located in: Dashboard >> Appearance>> Editor >> Footer.php
Since footer.php file executes in every page and post of WordPress, it is not necessary to place the code in all pages separately.
After placing the code wait for 2-3 days to get some data and click home tab to see some analytics report.
You might be interested in