When you’re implementing Google Analytics, it’s important to understand how the Google Analytics Tracking Code (GATC) is included on your Web pages.
On most websites, the GATC is not included manually on each page. Why? Because most midsized to larger Websites are based on page templates that provide the overall page structure – including header, footer, navigation, styling, database access, and coding elements – from which individual pages are dynamically constructed on the server when a visitor requests them in a browser.
Just as three examples, URLs such mysite.com/mypage.php, mysite.com/mypage.aspx, or mysite.com/mypage.jsp correspond to pages that:
- are dynamically generated as Apache/PHP, ASP.NET, and Java Server Pages respectively
- do not reside on the server as standalone .htm or .html files
- are very likely generated from a template
In most cases, when you’re including the GATC on your website, focus on page templates and not standalone HTML pages. While you can certainly add the GATC to standalone pages as needed, you can probably cover most of your site with the GATC physically included in only a small number of templates.