Forum Support

Shape 5
March 28, 2024, 11:35:56 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Shape 5 Forum
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Google Analytics Script being corrupted  (Read 585 times)
qrtrmaster
Jr. Member
**
Offline Offline

Posts: 42



« on: 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>
Logged
mikenicoll
Global Moderator
*****
Offline Offline

Posts: 20162



WWW
« Reply #1 on: 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
Logged

Mike Nicoll
------------
Shape 5 Team

- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
qrtrmaster
Jr. Member
**
Offline Offline

Posts: 42



« Reply #2 on: February 07, 2013, 07:23:23 AM »

Okay, that's fine.
But why is the template adding the forward slashes?
Logged
mikenicoll
Global Moderator
*****
Offline Offline

Posts: 20162



WWW
« Reply #3 on: 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
Logged

Mike Nicoll
------------
Shape 5 Team

- Need a great host for your website? We highly recommend siteground.com!


- Put your trust in the hands of our extremely qualified staff to get your job done right!


- Firebug is the most powerful web development and debugging tool, and it will save you a lot of time, frustration and forum questions:
Install Firebug
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2013, Simple Machines
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!
Looking for the largest variety in template designs? Look no more. Never buy 1 theme again. Signups start at just $89 for access to all of our themes.
Send Us An Email
Please send us your questions and we will email you back as soon as we can. Product support questions should be posted in our support forums under the Help menu. Our staff will assist you from there.