Hey guys,
I'm trying to add this code to my footer and I can't make it.
<!--/Start async trafic.ro/-->
<script type="text/javascript" id="trfc_trafic_script">
//<![CDATA[
t_rid = 'fly-ra-com';
(function(){ t_js_dw_time=new Date().getTime();
t_js_load_src=((document.location.protocol == 'http:')?'http://storage.':'https://secure.')+'trafic.ro/js/trafic.js?tk='+(Math.pow(10,16)*Math.random())+'&t_rid='+t_rid;
if (document.createElement && document.getElementsByTagName && document.insertBefore) {
t_as_js_en=true;var sn = document.createElement('script');sn.type = 'text/javascript';sn.async = true; sn.src = t_js_load_src;
var psn = document.getElementsByTagName('script')[0];psn.parentNode.insertBefore(sn, psn); } else {
document.write(unescape('%3Cscri' + 'pt type="text/javascript" '+'src="'+t_js_load_src+';"%3E%3C/sc' + 'ript%3E')); }})();
//]]>
</script>
<noscript><p><a href="http://www.trafic.ro/statistici/forum.fly-ra.com"><img alt="forum.fly-ra.com" src="http://log.trafic.ro/cgi-bin/pl.dll?rid=fly-ra-com" /></a> <a href="http://www.trafic.ro/">Web analytics</a></p></noscript>
<!--/End async trafic.ro/-->
I've edited index.template.php, tried to insert he code before </body> or after template_body_below() and I'm getting: syntax error, unexpected T_STRING, expecting ',' or ';'
What to do?
I know there are some mods out there, but I'm not passing the test while installing and I'm afraid to mess around with the code.
Any help appreciated.
You need to make sure you escape all single quotes in the code. So change all ' to \'
So my code became:
<!--/Start async trafic.ro/-->
<script type="text/javascript" id="trfc_trafic_script">
//<![CDATA[
t_rid = '\fly-ra-com'\;
(function(){ t_js_dw_time=new Date().getTime();
t_js_load_src=((document.location.protocol == '\http:'\)?'\http://storage.'\:'\https://secure.'\)+'\trafic.ro/js/trafic.js?tk='\+(Math.pow(10,16)*Math.random())+'\&t_rid='\+t_rid;
if (document.createElement && document.getElementsByTagName && document.insertBefore) {
t_as_js_en=true;var sn = document.createElement('\script'\);sn.type = '\text/javascript'\;sn.async = true; sn.src = t_js_load_src;
var psn = document.getElementsByTagName('\script'\)[0];psn.parentNode.insertBefore(sn, psn); } else {
document.write(unescape('\%3Cscri'\ + '\pt type="text/javascript" '\+'\src="'\+t_js_load_src+'\;"%3E%3C/sc'\ + '\ript%3E'\)); }})();
//]]>
</script>
<noscript><p><a href="http://www.trafic.ro/statistici/forum.fly-ra.com"><img alt="forum.fly-ra.com" src="http://log.trafic.ro/cgi-bin/pl.dll?rid=fly-ra-com" /></a> <a href="http://www.trafic.ro/">Web analytics</a></p></noscript>
<!--/End async trafic.ro/-->
I've inserted the code before </body> and no joy, still getting the error.
Did I change to much? Did I put the code it in to the wrong place?
' becomes \' not '\ like you did there ;)
My bad.
It really works! Thanks for helping me out.
You're welcome :)