Integrate Google Analytics into SE 3+

Integrate Google Analytics into SE 3+

For people new to LAMP and other programing languages, you might not be familiar with Google Analytics. Most people have, but for those that haven’t, its a free reporting tool that lets you track the stats and visitors of visitors on your social network. Here is a quick description on how you can add Google Analytics to your site.

Step One

Sign up for google analytics here, and add a site profile for your domain and proceed to the screen that gives you your tracking code. It should look something similar to this:

<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”>
try {
var pageTracker = _gat._getTracker(”UA-4——-”);
pageTracker._trackPageview();
} catch(err) {}</script>

Step Two

Go ahead and copy this code. You will need it when you edit the footer.tpl in the SocialEngine Admin section. Once you copy the code, go ahead and login to the admin section and navigate to HTML Templates. Once you get there, go ahead and click “footer.tpl” and the code should come up. Go ahead and scroll all the way to the bottom where it says </body>.  Now go ahead and paste your Analytics code right before this. Now right above where it says <script type…….> Type {literal} and right after where it says</script> type {/literal} .

The literal tags prevent Smarty (The template engine) from confusing some of the code you pasted. You will get error messages if you dont use those literal tags so hope that helps. If you have any problems or ideas post em so we can come up with some easy mods for everyone.




2 Responses to “Integrate Google Analytics into SE 3+”

  1. herman says:

    thnx its very helpful it is successfuly installed thank you verymuch

  2. Chou says:

    Great information. I tried it before but without the literal tag. Now I know why it did not work. Thanks for the tip buddy.