vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Statcounter Tracking / Plugin (https://vborg.vbsupport.ru/showthread.php?t=247876)

kwblue 08-03-2010 12:30 PM

Statcounter Tracking / Plugin
 
Hello,

I have been trying to find an answer to this here and on the .com site, but cannot seem to find it. Everyone wants the statcounter code in the templates, but I would like to create a plugin for it. (Why? Because I have multiple templates and do not want to have to put it in all the footers)

With that said.. How can I put <script> tags in a plugin? The counter doesn't appear to be tracking when it is put in there 'as is'.

The code is this:

Code:

<!-- Start of StatCounter Code -->
<script type="text/javascript">
var sc_project=2089680;
var sc_invisible=1;
var sc_security="87f60d6a";
</script>

<script type="text/javascript"
src="http://www.statcounter.com/counter/counter_xhtml.js"></script><noscript><div
class="statcounter"><a title="vBulletin analytics"
class="statcounter"
href="http://www.statcounter.com/vbulletin/"><img
class="statcounter"
src="http://c.statcounter.com/2089680/0/87f60d6a/1/"
alt="vBulletin analytics" /></a></div></noscript>
<!-- End of StatCounter Code -->


I also tried:

$output = '{code above}';

But didn't notice any tracking. Any help would be much appreciated! :)

vbplusme 08-09-2010 03:20 PM

you need to put the javascript in a template and call the template with your plugin code.

for example create a template called mystatcounter, dump your block of code in there and save it. Then create a statcounter plugin with something like :

PHP Code:

eval('$statcounter .= "' fetch_template('mystatcounter') . '";'); 

then you just need to place $statcounter where ever you want the code to execute... HTH


All times are GMT. The time now is 11:17 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.00983 seconds
  • Memory Usage 1,710KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete