Support » Plugin: Slimstat Analytics » [Plugin: WP SlimStat] javascript not included in my pages

  • Resolved niceandeasy


    I’ve use your plugin on several wp pages. But on all of them I’ve the same problem- no javascript on footer. I’ve of course turned on option on SlimStat panel.

    I’m not a programmer. I’m only a curious user who sometimes looks into php files to get some understanding of what’s going on.. so- sorry for lack of details and maybe some mistakes.

    I’ve noticed that in “wp-slimstat.php” there’s a condition:

    if ($this->tid > 0){

    and there folows code that is attached on footer.

    I’ve changed this conditional statement to if true to see, what’s happening.

    And whow, I see javascript on bottom of my page. But I also see, that ‘tid’ value equals to 0.

    So, I think that plugin have some problems with accessing this value from db… and then this stops from adding javascript code to footer.


    and what’s the reason for this behavior? what can I do?

Viewing 15 replies - 1 through 15 (of 28 total)
  • Plugin Author Jason Crouse


    Hi there,

    if that variable is not set, it means the new hit hasn’t been recorded into the database. Do you see any new visits in your stats?



    I see some visits (mostly by bots). what should I look at?

    I can also view records in my phpmyadmin panel.

    For my WP instance I use prefix- like “wp_”, “site1_”, “site2_” etc. For a moment I thought that maybe plugin didn’t work with it, but on the other hand, I see some tables like “wp_slim_stats”, “wp_slim_visits”.

    For my first site (with “wp_” prefix) I use slimstat for few days. I have 29 records in “wp_slim_stats” table with various ID values (non-linear values with various increments- some values missing, first=6, last= 48). 27 with visit_id=0, 2 with id=1 and id=2.

    In “wp_slim_visits” I see 2 records with IDs = 1,2, and with some values for “tracking_code”.

    I use W3 Total Cache, I also use some plugins like LightBox that adds some javascript to wp_footer (I already tried to disable them, but it didn’t help). Before slimstat I used Visitor Maps, but then I needed to switch on W3 Total Cache to speed up my page- so, Visitor Maps wasn’t able to track users any more, and I read that slimstat would work with W3TC. My page is

    Plugin Author Jason Crouse


    Hi there,

    what happens if you disable W3 Total Cache? Does the javascript appear? (or $this->tid has a value greater than zero)


    I’ve disabled W3TC (disabled functionality, then disabled plugin at all)

    Still tid=0 (slimstat_tid=’0′):

    <script type='text/javascript'>slimstat_tid='0';slimstat_path='';slimstat_blog_id='0';slimstat_session_id='2116519a9e3bee992514976b3bd8f877';</script><script type='text/javascript' src=''></script>

    as far as I can tell – the only other plugin that adds something to wp_footer is LightBox Plus (I’ve already checked it- I disabled LBP, but no help; currently LBP is disabled for clearity).

    BTW, I’m still forcing to show js code by using if true in your plugin code. I suppose reverting it back (if (this->tid > 0))would stop to add js code at all.

    Plugin Author Jason Crouse


    Okay, so it’s not W3TC. Can you give me access to your blog so that I can troubleshoot the issue directly in there? You can contact me here

    la buca delle lettere


    Plugin Author Jason Crouse


    Just to keep other users posted, this issue was resolved. It was a bug in WP SlimStat, which will be fixed in the next release.


    Was it fixed in version 2.4?

    I was using slimstat in the past, but i had to remove it as my server was a bit overloaded.. (not only because of slimstat). But it was working fine.

    I installed it (on my brand new server, yay) again and i’m having 2 problems, which may be linked.
    I’m using a multisite install. When activating the plugin on all the blogs, it fills the custom_js_path to my instead of the user’s blog domain. Is this normal?
    After one day, i checked the main blog stats, and wow 3000 visits.. Then checked all the users blogs.. empty!

    The other problem is that i do not see the js anyway on the users’ blog, only the main one…

    Tried purging the plugin, cleaning the slimstat_* options, dropping the tables.. It’s a no-no..

    Any help appreciated!


    When i say wow.. 3000 visits, it’s because i normally just have 100.. 🙂 so i think they all were counted on the main blog..

    Hum maybe the 3000 is ok as slimstat counts the bots, which i never counted with other software.. But like the person above, changing the tid > 0 part helped (i know it’s dirty).
    So it’s possible there’s something still wrong in the query..

    Note that the prefix_slim_stats tables are not being created!
    Only the outbound/visits ones for each blog (and the browsers/countries/screenres for the main one).

    Sorry for sending messages here many times.. But i wanted to give you as many details as possible..

    Plugin Author Jason Crouse



    did you use Proper Network Activation to activate my plugin on your network? That may be the reason why those tables haven’t been created.

    I’m using a multisite install. When activating the plugin on all the blogs, it fills the custom_js_path to my instead of the user’s blog domain. Is this normal?

    Where is that file located “physically” on the server? If you try to access it directly with your browser, do you see a 404 page?


    Yes i was using it Proper Network Activation.. Only the “stats” one isn’t created.

    The file is in the folder /mypersonalfolder/wordpress/wp-content/plugins/wp-slimstat
    No problem to access it..

    Are you sure there’s no problem with multisite in those latest versions?


    Plugin Author Jason Crouse


    I must admit I haven’t tested 2.4 in a Multisite environment. But nothing has changed since 2.3 from this point-of-view 🙂 Unless PNA is broken in 3.1, not sure about that. If wp_slim_stats (for each blog) is not there, you should try to create it manually.


    Hello Camu,
    I found a dirty way to fix both problems, in wp-slimstat.php:

    lines 162-165 i commented:

    //if (!$this->_create_table($stats_table_sql, $this->table_stats, true)){
    // // Update the table structure ( versions < 2.4 ), if needed
    // $this->_update_stats_table();
    and added:
    $this->_create_table($stats_table_sql, $this->table_stats);

    And this way the table “stats” got created for each blog!

    Then line 178, i commented:
    //add_option(‘slimstat_custom_js_path’, WP_PLUGIN_URL.’/wp-slimstat’, ”, ‘no’);

    and i put:

    add_option(‘slimstat_custom_js_path’, get_option(‘siteurl’).’/wp-content/plugins/wp-slimstat’, ”, ‘no’);

    This way each blog had the right URL, not the url of the main blog for the js!

    Hope it helps somebody.

    Plugin Author Jason Crouse


    Interesting 🙂 I will change the add_option in the official code, as that seems a good idea. As for the other change you made, thanks for sharing it 🙂


Viewing 15 replies - 1 through 15 (of 28 total)
  • The topic ‘[Plugin: WP SlimStat] javascript not included in my pages’ is closed to new replies.