Shape 5

Joomla Templates => Sienna - Club => : qrtrmaster February 06, 2013, 10:42:17 AM



: Google Analytics Script being corrupted
: qrtrmaster February 06, 2013, 10:42:17 AM
So I installed my Google Analytics script in the "SCRIPT TO BE APPENDED" area of the template editor.

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'XXXXXXXXXXXX']);
  _gaq.push(['_setDomainName', 'XXXXXXX.XXX]);
  _gaq.push(['_setAllowLinker', true]);
  _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>


And after each "save" of the template editor and backslash "\" is added to the code. Save again = another backslash. See below:

<script type=\\\\\\\"text/javascript\\\\\\\">

  var _gaq = _gaq || [];
  _gaq.push([\\\\\\\'_setAccount\\\\\\\', \\\\\\\'UXXXXXXXXXXXXXX\\\\\\\']);
  _gaq.push([\\\\\\\'_setDomainName\\\\\\\', \\\\\\\'XXXXXXXXXXX.COM\\\\\\\']);
  _gaq.push([\\\\\\\'_setAllowLinker\\\\\\\', true]);
  _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>


: Re: Google Analytics Script being corrupted
: mikenicoll February 06, 2013, 09:02:38 PM
Hello,

You can try to add the script directly to the index.php before the closing body tag to do this more directly.

-Mike


: Re: Google Analytics Script being corrupted
: qrtrmaster February 07, 2013, 07:23:23 AM
Okay, that's fine.
But why is the template adding the forward slashes?


: Re: Google Analytics Script being corrupted
: mikenicoll February 10, 2013, 05:10:05 PM
Hello,

I'm not really sure, there's nothing in the template that would add slashes like that. The template just echos whatever is in the input box.

Putting it directly in the index.php is probably the best solution if you are still having issues with it.

-Mike