Inserting Google Analytics tracking code using Contribute

You can insert Google Analytics code to your page easily using Adobe Contribute. Here comes the first question, how to get the Google Analytics Tracking Code? Register yourself in http://www.google.com/analytics/ .

Please follow the instructions mentioned below to add the tracking code to your page.

Finding your personalized Google Analytics Tracking Code

  • Log in to Google Analytics at http://www.google.com/analytics
  • From the Overview page, select the account that has the profile for the tracking code you’re looking for, as the code is profile-specific.
  • Select the profile from the accounts Overview page.
  • From that profile’s Actions column, click Edit
  • At the top right of the ‘Main Website Profile Information’ box, click Check Status

Below is an example of what the code snippet will look like.

<script type=”text/javascript”>
var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.“);
document.write(unescape(“%3Cscript src='” + gaJsHost + “google-analytics.com/ga.js‘ type=’text/javascript’%3E%3C/script%3E”));
</script>
<script>
try{
var pageTracker = _gat._getTracker(“UA-xxxxxx-x”);
pageTracker._trackPageview();
} catch(err) {}
</script>

Inserting the code to your page
Once you find the code snippet, then you need to copy and paste it into the bottom of your content, immediately before the </body> tag of each page you are planning to track. This can be achieved using Contribute, through Insertà HTML Snippet menu. For more information on HTML Snippet, refer to http://blogs.adobe.com/contribute/2009/06/are_you_a_power_user_try_using.html . If you use a common include, then you can edit the include file directly in Adobe Contribute CS5 and insert in it. In case you use a common template, you can enter it there using Dreamweaver.