I am trying to add tracking code to my site. I am using sigma templates. Could some one pls let me know which "template page" or pages I need to modify when google advised as follows: (also see screenshot). I have created a analyticstracking.php file and uploaded to root of my web. Now just need to amend the template files but not sure which ones! Paste this code on your site Copy the following code, then paste it onto every page you want to track immediately before the closing </head> tag. 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") ?>
This code should go into the layout.tpl template page as that is the overall (shell) template page which all other template files are placed within. When adding javascript to a template file you should also follow the smarty rules and place it between: {literal} ... your javascript code here ... {/literal}
I do not work .. I followed the directions, the 'I put both inside <head> and I tried but does not work in <body>
Follow Mike's instructions above and it will definetely work...the latest Google code says placement should be just before the closing </head> tag. If you can share a link, we may be able to see what's wrong...thanks
this is my code in layout.tpl and the site is www.mercatinoracing.it thanks Code: another code....... {/literal} {$header} {modulehook function="tpl_layout_head" options=""} <!--inizio analitic--> {literal} <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-********']); _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>{/literal} <!--fine analitic--> </head>
I took a look at your source code and the Google Analytics code is not there. Have you uploaded your updated layout.tpl file?