How to add Google Analytics tracking code to your Grav website

26 Apr 2016 google analytics

Google Analytics is a free web analytics service from Google, it allows us to keep tracks of:

  • Who visits your site
  • When they visit your website
  • Where did they arrive on your website from
  • What they do when they are on your website

Google Analytics also provides many other tools which are useful for webmasters.

In other content management systems like Joomla! or WordPress, we can add Google Analytics tracking code easily by installing a plugin, we can do the same in Grav.

If you haven't created a Google Analytics tracking code for your website yet, you can create one by going to analytics.google.com and log in with your Gmail account.

After you log in, click "Sign up" button.

Provide information for "Account Name", "Website Name", "Website URL" fields, select an industry category and select reporting time zone.

Scroll to the bottom of the page, click "Get Tracking ID" button and "I Accept" button in the next popup.

On the next page you can find your tracking ID.

You log into your Grav administration area. Click "Plugins" on the left menu.

You find "Google Analytics" plugin and click its "Install" button to install it.

At the bottom of the plugin setting page, you can see the field "Tracking ID". You copy the tracking ID you have created into this field.

If you enable cache, clear your cache. Visit your site and check your its HTML source code, you can see the JavaScript of Google Analytics inserted into your page with the tracking ID you provide.

That's it! Now you can monitor your Grav website with Google Analytics.