Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-08-2009, 11:55 PM
Mike1018's Avatar
Mike1018 Mike1018 is offline
 
Join Date: Dec 2009
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Error when adding the Google Tracking Code.

I am unaware of where to implant my Google Analytics JavaScript code. I hear it is best to place it in the VB Footer Template. So, this is my footer code:

Quote:
{vb:raw ad_location.ad_footer_start}
{vb:raw ad_location.global_above_footer}
<div class="footercontainer">
<div class="footercontainer2">
<div id="footer" class="floatcontainer footer">

<form action="{vb:raw vboptions.forumhome}.php" method="get" id="footer_select" class="footer_select">


<vb:if condition="$show['quickchooser']">
<select name="styleid" onchange="switch_id(this, 'style')">
<optgroup label="{vb:rawphrase quick_style_chooser}">
{vb:raw quickchooserbits}
</optgroup>
</select>
</vb:if>

<vb:if condition="$show['languagechooser']">
<select name="langid" onchange="switch_id(this, 'lang')">
<optgroup label="{vb:rawphrase quick_language_chooser}">
{vb:raw languagechooserbits}
</optgroup>
</select>
</vb:if>
</form>

<ul id="footer_links" class="footer_links">
<vb:if condition="$show['contactus']"><li><a href="{vb:raw vboptions.contactuslink}" rel="nofollow" accesskey="9">{vb:rawphrase contact_us}</a></li></vb:if>
<vb:if condition="$vboptions['hometitle']"><li><a href="{vb:raw vboptions.homeurl}">{vb:raw vboptions.hometitle}</a></li></vb:if>
<vb:if condition="$show['admincplink']"><li><a href="{vb:raw admincpdir}/index.php{vb:raw session.sessionurl_q}">{vb:rawphrase admin}</a></li></vb:if>
<vb:if condition="$show['modcplink']"><li><a href="{vb:raw modcpdir}/index.php{vb:raw session.sessionurl_q}">{vb:rawphrase mod}</a></li></vb:if>
<vb:if condition="$vboptions['archiveenabled']"><li><a href="archive/index.php">{vb:rawphrase archive}</a></li></vb:if>
{vb:raw template_hook.footer_links}
<vb:if condition="$vboptions['privacyurl']"><li><a href="{vb:raw vboptions.privacyurl}">{vb:rawphrase privacy_statement}</a></li></vb:if>
<vb:if condition="$vboptions['tosurl']"><li><a href="{vb:raw vboptions.tosurl}">{vb:rawphrase terms_of_service}</a></li></vb:if>
<li><a href="{vb:raw relpath}#top" onclick="document.location.hash='top'; return false;">{vb:rawphrase top}</a></li>
</ul>


<vb:if condition="$show['dst_correction']">
<!-- auto DST correction code -->
<form action="profile.php?do=dst" method="post" name="dstform">
<input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
<input type="hidden" name="do" value="dst" />
</form>
<script type="text/javascript">
<!--
var tzOffset = {vb:raw bbuserinfo.timezoneoffset} + {vb:raw bbuserinfo.dstonoff};
var utcOffset = new Date().getTimezoneOffset() / 60;
if (Math.abs(tzOffset + utcOffset) == 1)
{ // Dst offset is 1 so its changed
document.forms.dstform.submit();
}
//-->
</script>
<!-- / auto DST correction code -->
</vb:if>

<script type="text/javascript">
<!--
// Main vBulletin Javascript Initialization
vBulletin_init();
//-->
</script>
</div>
</div>
</div>
<div class="below_body">
<div id="footer_time" class="shade footer_time">{vb:rawphrase all_times_are_gmt_x_time_now_is_y}</div>

<div id="footer_copyright" class="shade footer_copyright">
<!-- Do not remove this copyright notice -->
{vb:rawphrase powered_by_vbulletin}
<!-- Do not remove this copyright notice -->
</div>
<div id="footer_morecopyright" class="shade footer_morecopyright">
<!-- Do not remove cronimage or your scheduled tasks will cease to function -->
{vb:raw cronimage}
<!-- Do not remove cronimage or your scheduled tasks will cease to function -->
{vb:raw vboptions.copyrighttext}
</div>

{vb:raw ad_location.ad_footer_end}
</div>
But, when I add my code it says: Parse error: syntax error, unexpected '[' in /home/content/h/e/r/herrs/html/includes/adminfunctions_template.php(4595) : eval()'d code on line 131

This is likely caused by a malformed conditional statement.

Any ideas on how to fix this?

Many Thanks,
Mike
Reply With Quote
  #2  
Old 12-09-2009, 02:58 AM
badawidollah badawidollah is offline
 
Join Date: Nov 2008
Posts: 179
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i got same problem
cant add google analityc scripts

where to inplant it
Reply With Quote
  #3  
Old 12-09-2009, 03:23 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I put it into the template ad_footer_end. But, you can also put it at the end of the footer code. But, until they fix the bug with parsing some javascript, you will need to wrap it in <vb:literal> tags. This was talked about in a few threads over on vb.com.

Please see this sticky regarding questions about default vB4 - Installation Issues / Questions or bug reports regarding default vBulletin 4.0

And please use the code tags for code, not the Quote tags. Thank you.
Reply With Quote
  #4  
Old 12-09-2009, 03:46 AM
BBR-APBT's Avatar
BBR-APBT BBR-APBT is offline
 
Join Date: Feb 2009
Location: Maryland
Posts: 946
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I found its a problem when they do the final rendering on the templates. It tries to parse the java with in the php. Any time I try to input javascript in the template its self I get a parse error.

There is two solutions.

One would be to use this which I coded to make it easy.
https://vborg.vbsupport.ru/showthread.php?t=229347

Two would be to put the javascript in its own file and include the javascript file with in the footer.
Reply With Quote
  #5  
Old 12-09-2009, 03:57 AM
Runcolo Runcolo is offline
 
Join Date: Dec 2009
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I put mine at the end of the footer, had zero problems.
Reply With Quote
  #6  
Old 12-09-2009, 04:03 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BBR-APBT View Post
I found its a problem when they do the final rendering on the templates. It tries to parse the java with in the php. Any time I try to input javascript in the template its self I get a parse error.

There is two solutions.

One would be to use this which I coded to make it easy.
https://vborg.vbsupport.ru/showthread.php?t=229347

Two would be to put the javascript in its own file and include the javascript file with in the footer.
Or three, just wrap the <vb:literal> tags around your javascript.

(And java is not short for javascript - they are two very different languages. Why they are named so similarly, who knows! )

Quote:
Originally Posted by Runcolo View Post
I put mine at the end of the footer, had zero problems.
My guess is you are using the old code. The old code has no problems, but the new code does.
Reply With Quote
  #7  
Old 12-09-2009, 06:40 AM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
(And java is not short for javascript - they are two very different languages. Why they are named so similarly, who knows! )
I think because of netscape^^
Reply With Quote
  #8  
Old 12-09-2009, 02:28 PM
Mike1018's Avatar
Mike1018 Mike1018 is offline
 
Join Date: Dec 2009
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, Lynne, and sorry for the quotes. I actually imputed the old Javascript code, and it is collecting data as we speak. Thanks for you help. It's all appreciated!

Mike
Reply With Quote
  #9  
Old 12-09-2009, 03:09 PM
BBR-APBT's Avatar
BBR-APBT BBR-APBT is offline
 
Join Date: Feb 2009
Location: Maryland
Posts: 946
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Or three, just wrap the <vb:literal> tags around your javascript.

(And java is not short for javascript - they are two very different languages. Why they are named so similarly, who knows! )



My guess is you are using the old code. The old code has no problems, but the new code does.
I did not know about the <vb:literal> lol I been making .js files.
Reply With Quote
  #10  
Old 12-22-2009, 07:54 PM
s0lidgr0und's Avatar
s0lidgr0und s0lidgr0und is offline
 
Join Date: Dec 2006
Location: Colonie, New York
Posts: 214
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks, Lynne.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:10 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04630 seconds
  • Memory Usage 2,265KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete