X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   pasting pixel tracking code in template is changed by site (https://forum.x-cart.com/showthread.php?t=67726)

keystone 09-11-2013 09:17 AM

pasting pixel tracking code in template is changed by site
 
Hi,
I am trying to paste some javascript pixel tracking code at the bottom of skin/ideal_responsive/customer/home.tpl on my Version 4.6.0 site like this, when I post this code...

Code:

<script type="text/javascript">
adroll_adv_id = "xxxxxxxxxxxxxxxx";
adroll_pix_id = "xxxxxxxxxxxxxxxx";
(function () {
var oldonload = window.onload;
window.onload = function(){
  __adroll_loaded=true;
  var scr = document.createElement("script");
  var host = (("https:" == document.location.protocol) ? "https://s.adroll.com" : "http://a.adroll.com");
  scr.setAttribute('async', 'true');
  scr.type = "text/javascript";
  scr.src = host + "/j/roundtrip.js";
  ((document.getElementsByTagName('head') || [null])[0] ||
    document.getElementsByTagName('script')[0].parentNode).appendChild(scr);
  if(oldonload){oldonload()}};
}());
</script>


on the page source it looks like this...

Code:

<script type="text/javascript">
adroll_adv_id = "xxxxxxxxxxxxxxxxxxxxxx";
adroll_pix_id = "xxxxxxxxxxxxxxxxxxxxxx";
(function () };
}());
</script>


with most of the code missing. Anyone know why this is happening and how to make it show up correctly?

cflsystems 09-11-2013 09:38 AM

Re: pasting pixel tracking code in template is changed by site
 
You need to enclose it in {literal} tag for smarty to ignore it otherwise it is trying to interpret it

{literal}
code here
{/literal}

keystone 09-11-2013 09:47 AM

Re: pasting pixel tracking code in template is changed by site
 
Oh, that's right. I had been told that before and forgot about it. How would I go about adding defer loading? Or is there a better way to add this code so it gets cached with the other .js code on site?


All times are GMT -8. The time now is 11:26 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.