FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » adding Google analytics
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: adding Google analytics [message #163472 is a reply to message #163471] Wed, 03 November 2010 01:59 Go to previous messageGo to previous message
newbit is currently offline  newbit   China
Messages: 29
Registered: November 2010
Karma:
Junior Member
Here's the complete code snippet.


{MAIN_SECTION: header forum page header}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="{DIR}" lang="{LANG}" xml:lang="{LANG}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}" />
<title>{GVAR: FORUM_TITLE}{VAR: TITLE_EXTRA}</title>
<meta name="description" content="{GVAR: FORUM_DESCR}" />
<base href="{FULL_ROOT}" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="lib.js"></script>
<link rel="stylesheet" href="{THEME_ROOT}/forum.css" type="text/css" media="screen" title="Default FUDforum Theme" />
<link rel="search" type="application/opensearchdescription+xml" title="{GVAR: FORUM_TITLE} Search" href="{FULL_ROOT}open_search.php" />
{VAR: RSS}
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXXXX-1']);
  _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>
</head>


This gets:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/atampjq/public_html/fudforum/theme/default/thread.php on line 586


OK, so I search & replace and put \ in front of all the ' in the Google Analytics code, even though the documentation says nothing about doing this. Like so:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push([\'_setAccount\', \'UA-19456515-1\']);
  _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>


This gets:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/atampjq/public_html/fudforum/theme/default/thread.php on line 585

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/atampjq/public_html/fudforum/theme/default/thread.php on line 594

[Updated on: Wed, 03 November 2010 02:15]

Report message to a moderator

[Message index]
 
Read Message
Read Message icon6.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Suppress rejection emails ?
Next Topic: uploaded pictures won't show
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 22:08:45 GMT 2024

Total time taken to generate the page: 0.05708 seconds