How to insert Googla Analytics code into ADP?

Get general support for ADP here.

Moderator: pgolovko

How to insert Googla Analytics code into ADP?

Postby Tibor » 10/23/2009 3:49 am

I am not an expert of php at all, so maybe my problem is not a big challenge for some other guys...

If I simply insert the given Analytics code into footer.html, I get an error message:

Fatal error: Smarty error: [in footer.html line 24]: syntax error: unrecognized tag 'var'
(Smarty_Compiler.class.php, line 590) in /mnt/var/www/virtual/adatbazisinfo.hu/linkek/htdocs/admin/smarty/Smarty.class.php on line 1093

The problem is with the line containing "try {" in that part of the added code:
Code: Select all
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-2017478-11");
pageTracker._trackPageview();
} catch(err) {}</script>

Another method suggested by Google Analytics is to create analyticstracking.php. But that brings some further questions to me:
  • Where should I put that file? Path /admin ?
  • Where should I call this php code? footer.html, or one of the .php files? The suggested line to insert is:
Code: Select all
<?php include_once("analyticstracking.php") ?>


Thanks in advance for any hint or solution!
Tibor
 
Posts: 9
Joined: 10/23/2009 1:00 am


Re: How to insert Googla Analytics code into ADP?

Postby gc_rjauregui » 10/23/2009 5:27 am

Quite simple:

Code: Select all
{literal}
<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("GOOGLEACTNO");
pageTracker._trackPageview();
} catch(err) {}</script>
{/literal}


EDIT: Just put this in footer.html, it is called on all client-side pages.
Best Regards,

Ryan Jauregui
geekcoders development member

laf innovative | development blog
User avatar
gc_rjauregui
Site Admin
 
Posts: 394
Joined: 03/25/2006 1:23 am
Location: Stanton, CA

Re: How to insert Googla Analytics code into ADP?

Postby Tibor » 10/23/2009 11:01 am

Thanks a lot!
It's one of the big IT moments: Something works at the first attempt :)
(Disregarded my earlier experiments)
Tibor
 
Posts: 9
Joined: 10/23/2009 1:00 am

Re: How to insert Googla Analytics code into ADP?

Postby gc_rjauregui » 10/23/2009 12:41 pm

Tibor wrote:Thanks a lot!
It's one of the big IT moments: Something works at the first attempt :)
(Disregarded my earlier experiments)

I love when that happens. ;)
Best Regards,

Ryan Jauregui
geekcoders development member

laf innovative | development blog
User avatar
gc_rjauregui
Site Admin
 
Posts: 394
Joined: 03/25/2006 1:23 am
Location: Stanton, CA


Return to Support

Who is online

Users browsing this forum: No registered users and 0 guests

cron