<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def configure_google_analytics():
 """An optional task; if run, this will switch on Google Analystics, reporting documentation usage to Aviser. This is meant to be run only by Aviser when producing HTML for the main web site. """

    f = open(os.path.join("doc", "_templates", "google-analytics.html"), "w")
    f.write("""<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-31981784-1']);
_gaq.push(['_setDomainName', 'aviser.asia']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);

(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>""")
    f.close()