How to add Google Analytics and Webmaster tools to your site

To connect Google Analytics or Webmaster tools to your side you need to include a script before the closing head tag. Use GA to monitor the visitor’s behaviour such as total visits, unique visitors, page visit duration and much more. Use GWT to monitor keywords, submit sitemaps and detect indexing issues with your site

What are they used for?

Google Analytics

Google Analytics or GA it’s most common use case is monitor your site’s traffic. Traffic being the amount of total page visits, unique visits, type of devices and much more.

You can also track how people get in touch with site (Via Google search, directly or social media).

Google Webmaster tools

Google Webmaster tools or GWT, also named Search Console is a tool to monitor the health of your website by keeping track of search terms, crawlissues and much more.

Search Console overview

This is a graph that represents a website of mine, you can see over a period of time the amount of clicksvisitsclick-through-rate and position the website has. But you can also see this foreach keyword, which is very handy!

Let Google know your site exists by submitting it to the search engines, preferably with a sitemap! You can see how many pages are indexed and why they’re not.

The fetch as Google option also verifies your is in good condition to getting crawled by Google. You can also submit the result and request indexing.

How to add GA and WMT to your site

Let’s start with GA, as it’s way easier to add WMT afterwards.

Google Analytics

You should first add a GA property to your GA account, a form will open which requests the site name, url, category and timezone.

After creation, you’ll receive a tracking code similar to this:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=<YOUR-ID>"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', '<YOUR-ID>');
</script>

Add this code before the close </head> tag.

Back to GA to verify this script and voila! GA is setup.

Webmaster tools Since your GA account and your webmaster tools account are the same thing, it’s really easy to sync those up.

Add a property and add it’s url, preferabbly https://www and rewrite all your links to this one, if you do not do this you should add every extension you can think of.

When added, you’ll have to verify your website. Since you already have GA installed you can use the same code by choosing the “Verify with GA” option (usually the default)”.

You’re all set!

Starting adding your sitemap to the GWT and have fun experimenting.