Forums | Mahara Community

Support /
Google Analytics


anonymous profile picture
Account deleted
Posts: 31

26 March 2012, 0:09

Hi everyone,

I am wanting to add google Analytics to my mahara. In the setup instructions it says

"For any PHP pages, put the following code in a file (for example, analyticstracking.php) and upload it to your site. Then, add the following line to each template page immediately after the opening <body> tag: <?php include_once("analyticstracking.php") ?>"


What would be the template page they are referring to?


Thanks,

Mathew

anonymous profile picture
Account deleted
Posts: 808

26 March 2012, 20:30

Hi Mathew, you'll find the opening <body> tag in this template: htdocs/theme/raw/templates/header.tpl

However, it's a Dwoo template, not a php template, so it has a different syntax and you don't want to use <?php include_once(... ?>.

You could paste the google analytics <script> tag directly into that header.tpl template.

Alternatively, if you want to keep things cleaner, you could put the script tag in a file called something like "analyticstracking.tpl" in the same folder, and then put this line after the <body> tag in header.tpl:

 {include file='analyticstracking.tpl'}
2 results