I assume you have completed your website may be in WordPress or Joomla or Drupal or anything just html. Now you want to track your website user and their activity on site. Also want to improve search result in google. Before adding analytic or opening account at webmaster tool, make sure your website is ready for tracking.
Point to check before moving further:
- Sitemap: Build sitemap to submit to in google webmaster tool. For this you can use plugin to generator sitemap automatically. There are some free online tool you can use to generator. That is XML Sitemaps Generator. This tool is specially designed for submitting sitemap.
- Add robots.txt file in your web root folder where website is hosted. This will allow you to not search unnecessary pages from your site, example admin, or dashboard pages.
Put this code in your robots.txt file and add directory or pages you don’t want to crawl.
User-agent: * Disallow: /cgi-bin/ Disallow: /tmp/ Disallow: /~mywebsite/ bar.html Sitemap: https://www.yourwebsite/sitemap.xml
Good example will be google robots.txt file itself. After this you are fully ready for next step.
Get analytic code to track your website.
- Login to google analytics using gmail account. Click on admin menu text.
- From account dropdown choose “Create new account”.
- Type your account name and website name anything you want.
- Then copy paste your website url like www.cmsfriendly.com without “http://” under Website URL.
- Choose Industry Category and Reporting Time Zone as per your requirement.
- Select the recommended checkboxes and finally click on “Get Tracking ID” button.
- Accept the Google Analytics Terms of Service Agreement by clicking on “I Agree” button.
After this you are going to get Tracking ID along with two type of code Website tracking and PHP Implementation.
At this point we can simple copy the website tracking code and put it in our html just before the closing of body tag </body> . You need to put this code in each of the page where website need to be tracked. In case you have so many pages, this will be trouble for you. Lucky if your site is build out of PHP CMS then it is very simple. Install plugin, add your tracking id, that it.
In case of custom php system, add your website tracking code in a php file and include this to template. PHP implementation code given by google analytic work same.
Testing analytic tracking code:
- Visit your website on browser. Press CTRL + u on keyboard to get the page source.
- Ctrol + F to search your code, type “analytics.js” at this point if you have correctly added the code you are able to see the code here, else check again in your file.
- If your code is visible then login to google analytic, click on reporting , go to real-time verticle tab. Here you can able to see active user at least 1, this mean your code is working properly.
To control over the search result page from google
- Create google webmaster account using gmail id, login to account.
- Click on add a property button. Type your website address.
- As soon as you click on add button, this will redirect to confirm your ownership page. If you have already added google analytic, the recommended option will be already selected. Click on very button. Congratulations, you have just confirm the ownership.
- To crawl the whole website, go to crawl menu and click on fetch as google. Without adding any extra text to your root website click on “Fetch and Render”.
Additionally submit your sitemap for better results. If you find any issue under your webmaster account, you will get message from google to resolve.
Put your comment below for any quires thank you very much for reading.