Google Analytics is a free service from Google that allows you to analyze your site traffic in a multitude of various ways, and we highly recommend using it to track the stats of your Heroic site.
Installing Google Analytics onto your Heroic site
- Visit Google Analytics at https://Analytics.Google.com (setup a new account if you don't already have one)
- Find your Universal Analytics code and copy to clipboard -- it will look like the following:
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxx-x"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-xxxxxxxxx-x');
</script>
Once you have your GA snippet:
- Go back to Heroic, and click on the icon in the left panel
- Click Site Settings
- Click Third Party Code
- Finally, paste your code snippet into either the Header field
How do you tell whether to use Header or Footer?
Great question. Some apps and services will clearly specify whether their code needs to be in the Header or Footer of your site.
You should check the installation instructions of your widget to be sure.
If they don't provide any specific guidance, then put your code into the Footer area. Since any code added to your Footer gets loaded last, it won't slow down your site load time.