Google Analytics

If you are a user of Google Analytics, you may want to use the service with one of your Textpattern installations.

Create a form called google_analytics

Assuming you already have a Google Analytics account, login and get the Analytics code for your site.

<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 type="text/javascript">
var pageTracker = _gat._getTracker("your user account id");
pageTracker._trackPageview();
</script>

Enter the above into your new form, and make sure to add your user account id. Save as type misc.

Place a call to Google Analytics in your page template

Just before the closing </body> tag, place the following:

<!-- google analytics -->
<txp:output_form form="google_analytics" />

Once this is done, you should be able up and running. Check your Google Analytics account for reports and options.

comments powered by Disqus