WordPress.org

Ready to get started?Download WordPress

Forums

WP Slimstat
[resolved] [Plugin: WP SlimStat] javascript not included in my pages (29 posts)

  1. niceandeasy
    Member
    Posted 3 years ago #

    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.

    Right?

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

    http://wordpress.org/extend/plugins/wp-slimstat/

  2. camu
    Member
    Plugin Author

    Posted 3 years ago #

    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?

    Camu

  3. niceandeasy
    Member
    Posted 3 years ago #

    Hi,

    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 blog.koszykzdomenami.pl

  4. camu
    Member
    Plugin Author

    Posted 3 years ago #

    Hi there,

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

    Camu

  5. niceandeasy
    Member
    Posted 3 years ago #

    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='http://blog.koszykzdomenami.pl/wp-content/plugins/wp-slimstat';slimstat_blog_id='0';slimstat_session_id='2116519a9e3bee992514976b3bd8f877';</script><script type='text/javascript' src='http://blog.koszykzdomenami.pl/wp-content/plugins/wp-slimstat/wp-slimstat.js'></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.

  6. camu
    Member
    Plugin Author

    Posted 3 years ago #

    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

    http://www.duechiacchiere.it/contatto

    Thanks
    Camu

  7. camu
    Member
    Plugin Author

    Posted 3 years ago #

    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.

    Camu

  8. kevinff
    Member
    Posted 3 years ago #

    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 mainsite.com/wp-content/plugins/wp-slimstat 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!

    Kevin

  9. kevinff
    Member
    Posted 3 years ago #

    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..

  10. kevinff
    Member
    Posted 3 years ago #

    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..

  11. kevinff
    Member
    Posted 3 years ago #

    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..

  12. camu
    Member
    Plugin Author

    Posted 3 years ago #

    Kevinff,

    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 mainsite.com/wp-content/plugins/wp-slimstat 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?

    Camu

  13. kevinff
    Member
    Posted 3 years ago #

    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?

    Kevin

  14. camu
    Member
    Plugin Author

    Posted 3 years ago #

    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.

    Camu

  15. kevinff
    Member
    Posted 3 years ago #

    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.

  16. camu
    Member
    Plugin Author

    Posted 3 years ago #

    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 :)

    Camu

  17. kevinff
    Member
    Posted 3 years ago #

    Just to say that i still had to modify wp-slimstat with version 2.4.2, as the stats table was not being created :s
    Also i noticed that you added a check on the referer. It gave me problems with domains mapped with the domain mapping plugin. I changed this in wp-slimstat-js.php:
    Search for something like this "if (empty($_SERVER['HTTP_REFERER']) || ((strpos($_SERVER['HTTP_REFERER'], $site_url) === false"

    And i replaced the full line with:
    if (empty($_SERVER['HTTP_REFERER']) || ((strpos($_SERVER['HTTP_REFERER'], $site_url) === false ) && strpos($_SERVER['HTTP_REFERER'], "http://" . $_SERVER['HTTP_HOST']) === false ) ){

    Hope it helps somebody again :)

  18. camu
    Member
    Plugin Author

    Posted 3 years ago #

    I'll review the code next week, thank you for the heads-up :) the 'option' thingy slipped through the cracks I guess, I'll take care of that as well.

    Camu

  19. kevinff
    Member
    Posted 3 years ago #

    Well that last update made it worse for WPMU installs :(
    Now i don't even have 1 table created. I read that the new network activation is experimental so i'm not too worried :)

    I wish i knew more about this part of wp, i would be glad to fix it..

  20. camu
    Member
    Plugin Author

    Posted 3 years ago #

    Kevin, I found the bug that is causing this behavior in some cases. I have a new version available, but I'm still testing it. Would you like to get a copy to test it?

    contact me at

    http://www.duechiacchiere.it/contatto

    cheers
    camu

  21. camu
    Member
    Plugin Author

    Posted 3 years ago #

    Sent.

  22. kevinff
    Member
    Posted 3 years ago #

    No improvement, sorry :(
    I've installed wp 3.2, enabled multisite with subdomains, installed wp-slimstat.
    Then created a new user + new blog, activated.. And no, no slimstat tables :(
    I've also tried with the proper-activation-plugin..
    Sorry :(

  23. kevinff
    Member
    Posted 3 years ago #

    Maybe i wasn't clear: in the main site there are the slimstat tables but not in the new users blogs (stat, visits..)

  24. camu
    Member
    Plugin Author

    Posted 3 years ago #

    I guess I know what the problem is. Thank you for your patience. I will send you a new version shortly. I need to test it.

    Camu

  25. camu
    Member
    Plugin Author

    Posted 3 years ago #

    Kevin, can you send me a message again? For some mysterious reason I cannot find your email address anymore :)

    Camu

  26. kevinff
    Member
    Posted 3 years ago #

    Your latest version seems to be working!!! :)
    Thanks a lot Camu!

  27. camu
    Member
    Plugin Author

    Posted 3 years ago #

    This is awesome news, my friend :) I will implement the same tricks in my other plugin then. Also, this one I sent you doesn't remove the tables when a blog is deleted, I'm planning to fix that part as well.

    Camu

  28. kevinff
    Member
    Posted 3 years ago #

    Hello camu,

    Here's what i get when activating a new blog with the latest slimstat version and multisite wp:

    Fatal error: Using $this when not in object context in /*******/wp-content/plugins/wp-slimstat/wp-slimstat.php on line 101

    It doesn't create the slimstat tables, but it might be because of this error..

  29. camu
    Member
    Plugin Author

    Posted 3 years ago #

    Kevin, in line 99 replace the word static with 'public' (without single quotes, of course). I will fix that soon, sorry for the inconvenience.

    Camu

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic