Editor's note:
Thanks for visiting GA Tip of the Day. Please see current posts on the Cardinal Path blog.

Including the Tracking Code in Page Templates and Standalone Pages

view at full size

You can include the GATC in page templates or, as needed, on individual pages.

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.

Please share this post:
Facebook Twitter Plusone Linkedin Email

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>