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

Home » General » PHP discussions » Google Analytics
Show: Today's Messages :: Unread Messages :: Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
Google Analytics [message #163150] Sun, 03 October 2010 00:31 Go to next message
Volvospeed is currently offline  Volvospeed   United States
Messages: 17
Registered: September 2010
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
I just tried inserting my analytics code in the footer file and got the following error after rebuilding the theme:

T_CONSTANT_ENCAPSED_STRING on line 492

Line 492 of the index.php file is:

var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

Everything looks ok to me. I tried breaking out the code but had the same issue. Anyone else seen this before I spend to much time looking into it?
Re: Google Analytics [message #163151 is a reply to message #163150] Sun, 03 October 2010 04:11 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3732
Registered: December 2004
Karma: 26
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
Difficult to say.
I don't see the code in question on your site.
Can you please post steps to reproduce or point us to a page with the problem?
Message by Ernesto is ignored  [reveal message]  [reveal all messages by Ernesto]  [stop ignoring this user] Go to previous messageGo to next message
Re: Google Analytics [message #163156 is a reply to message #163152] Sun, 03 October 2010 10:34 Go to previous messageGo to next message
Volvospeed is currently offline  Volvospeed   United States
Messages: 17
Registered: September 2010
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
I tried echo first and after a quick search found the \ suggestion. Neither one worked but incase I was crazy/tired I tried again.

var s = document.getElementsByTagName('\script\')[0]; s.parentNode.insertBefore(ga, s);

Gave me the same error as before. The footer section from the index.php file:

Quote:
</script>
<div style="text-align: center;">
<script type="text/javascript"><!--
google_ad_client = "pub-89928376906811";
/* 728x90, created 9/23/10 */
google_ad_slot = "1253056536";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br>
<br>
</b><b>.::</b> Didn't Find What You Are Looking For? Visit Our Parent
Site <a href="http://volvospeed.com/vs_forum/">Volvospeed</a> <b>::.</b>
<b><br>.::</b> <a href="mailto:webmaster(at)volvospeed(dot)com">Contact</a> <b>::</b>
<a href="index.php?t=index&amp;">Home</a> <b>::.<br>
</td></tr></table>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-315562-4']);
_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') + <?php echo google-analytics.com/ga.js';
var s = document.getElementsByTagName('\script\')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>


I changed the account numbers but other wise thats whats causing the error. I am not leaving it like that as it breaks the board. So saving grace is it is easy to roll back and get the board working again.
Message by Ernesto is ignored  [reveal message]  [reveal all messages by Ernesto]  [stop ignoring this user] Go to previous messageGo to next message
Message by Ernesto is ignored  [reveal message]  [reveal all messages by Ernesto]  [stop ignoring this user] Go to previous messageGo to next message
Message by Ernesto is ignored  [reveal message]  [reveal all messages by Ernesto]  [stop ignoring this user] Go to previous messageGo to next message
Re: Google Analytics [message #163160 is a reply to message #163159] Sun, 03 October 2010 11:13 Go to previous messageGo to next message
Volvospeed is currently offline  Volvospeed   United States
Messages: 17
Registered: September 2010
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
I typoed it today apparently but thats what I had last night. After a rebuild of the theme I get:


Quote:
Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /home/s40con/public_html/forum/theme/volvospeed/index.php on line 488

Parse error: syntax error, unexpected T_VAR in /home/s40con/public_html/forum/theme/volvospeed/index.php on line 489
Message by Ernesto is ignored  [reveal message]  [reveal all messages by Ernesto]  [stop ignoring this user] Go to previous messageGo to next message
Message by Ernesto is ignored  [reveal message]  [reveal all messages by Ernesto]  [stop ignoring this user] Go to previous messageGo to next message
Re: Google Analytics [message #163163 is a reply to message #163162] Sun, 03 October 2010 11:48 Go to previous messageGo to next message
Volvospeed is currently offline  Volvospeed   United States
Messages: 17
Registered: September 2010
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Quote:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push([\'_setAccount\', \'UA-315562-4\']);
_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>


Did the trick. As for rhw format, thats the formatt I got off google this morning. The old code went in the head, and the newer one they suggest goes in the body. Either way that di the trick. THANK YOU!
Re: Google Analytics [message #163164 is a reply to message #163163] Mon, 04 October 2010 02:05 Go to previous messageGo to next message
Volvospeed is currently offline  Volvospeed   United States
Messages: 17
Registered: September 2010
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Well it did not cause any errors, but its also not working.
Works at:
http://s40concepts.net/
But not broken out at http://s40concepts.net/forum/
Message by Ernesto is ignored  [reveal message]  [reveal all messages by Ernesto]  [stop ignoring this user] Go to previous messageGo to next message
Re: Google Analytics [message #163166 is a reply to message #163165] Mon, 04 October 2010 10:32 Go to previous messageGo to next message
Volvospeed is currently offline  Volvospeed   United States
Messages: 17
Registered: September 2010
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Thats the way I orginally had it which gives you this:

Quote:
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/s40con/public_html/forum/theme/volvospeed/index.php on line 488

Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /home/s40con/public_html/forum/theme/volvospeed/index.php on line 488

Parse error: syntax error, unexpected T_VAR in /home/s40con/public_html/forum/theme/volvospeed/index.php on line 489


I would have thought a ton of people here would be running analytics
Re: Google Analytics [message #163169 is a reply to message #163166] Mon, 04 October 2010 12:48 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3732
Registered: December 2004
Karma: 26
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
Mail me an admin userid/password to your forum so I can have a look.

PS: I've just enabled Google Analytics on this forum and it was a quick and painless process.
Message by Ernesto is ignored  [reveal message]  [reveal all messages by Ernesto]  [stop ignoring this user] Go to previous messageGo to next message
Re: Google Analytics [message #163171 is a reply to message #163170] Mon, 04 October 2010 13:19 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3732
Registered: December 2004
Karma: 26
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
On a side note, the Google_analytics.plugin will be an interesting angle in FUDforum 3.0.2.
Message by PaulinoAlo is ignored  [reveal message]  [reveal all messages by PaulinoAlo]  [stop ignoring this user] Go to previous messageGo to next message
Re: Google Analytics [message #167099 is a reply to message #166376] Mon, 23 April 2012 02:30 Go to previous messageGo to next message
Mac John is currently offline  Mac John
Messages: 3
Registered: April 2012
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Same problem happens with me. But i have solved it to put analytic in Meta, For al lstatic pages not in PHP.
Re: Google Analytics [message #167100 is a reply to message #167099] Mon, 23 April 2012 02:38 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3732
Registered: December 2004
Karma: 26
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
It's much easier to just enable the provided Google analytics plugin.
Re: Google Analytics [message #167101 is a reply to message #167100] Mon, 23 April 2012 02:43 Go to previous messageGo to next message
Mac John is currently offline  Mac John
Messages: 3
Registered: April 2012
Karma: 0
Junior Member
add to buddy list
ignore all messages by this user
Is there any tutorial about Google plugin?
Because i am newbie and cant better understand without tutorial

Thanks
Re: Google Analytics [message #167102 is a reply to message #167101] Mon, 23 April 2012 03:47 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3732
Registered: December 2004
Karma: 26
Senior Member
Administrator
Core Developer
remove from buddy list
ignore all messages by this user
Step 1: Navigate to the Plugin Manager ACP.
Step 2. Ensure that the plugin system is enabled.
Step 3. Enable the plugins you want.
Re: Google Analytics [message #167434 is a reply to message #167102] Tue, 19 June 2012 07:04 Go to previous message
Anonymous
I am also looking for google plugin tutorial...help required plz
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: Adding javascript code to a php doc
Next Topic: Problems getting LDAPS to work
Goto Forum:
  

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

Current Time: Mon Jul 13 18:17:15 EDT 2020

Total time taken to generate the page: 0.00667 seconds