Support » Plugin: Top 10 - Popular posts plugin for WordPress » How to stop measuring stats in some cases?

  • Resolved Grzegorz.Janoszka

    (@grzegorzjanoszka)


    Hi,
    First of all I would like to thank for this fantastic and awesome plugin. I am very happy with it!
    I really appreciate author’s support and the feature “Load tracker on all pages” was implemented after my suggestion, as far as I remember. Thank you one more time.

    I have a wordpress post, which offers some kind of calculator and it is often visited, one of the top posts on my site. I know I could do the calculator in JS, but I prefer to send a form and display a result after page load. I have Google ads on my site and the more page loads, the more ads I display.

    I want to know how many people got to the bare post, without sending any data to see results. So I added a short code:

    if (!empty($_POST)) {
        remove_action( 'wp_enqueue_scripts', 'tptn_enqueue_scripts' );

    It achieved the goal, and the initial visit is counted, but when the visitor enters some data to calculate it, I don’t count visits.

    Unfortunately it removes all the advantage of “Load tracker on all pages” and my autoptimize plugin creates a separate js file without just top-10 code, which I don’t want.

    What can I do to have top-10 script in the source of the page but somehow have a switch, whether I want to have the visit counted or not?

    I know it might be a pretty exotic request, but I would really appreciate if there was a way to achieve it – to have top-10 JS code, but without counting the visit.
    It may count something else instead like a dummy post, I don’t mind.

    Thank you in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ajay

    (@ajay)

    @grzegorzjanoszka yes it was on your request. And, it’s inspired me to see what else I can track – yet to figure out how exactly!

    One way I think is by using your same logic above, but passing a different set of args with a filter function

    https://github.com/WebberZone/top-10/blob/master/includes/tracker.php#L86

    You can set activate_counter to 0 or just pass top_ten_id as 0

    • This reply was modified 6 months, 4 weeks ago by Ajay.
    Thread Starter Grzegorz.Janoszka

    (@grzegorzjanoszka)

    Ajay,
    I got it working by using tptn_tracker_script_args. The suggestion you posted didn’t really work as I am using the fast tracker.
    Thank you again for fantastic support 🙂

    Plugin Author Ajay

    (@ajay)

    Thank you for confirming and the comment 🙂

    I’m starting to think you probably know my plugin better than me. Also glad to know you’re using my fast tracker add-on.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to stop measuring stats in some cases?’ is closed to new replies.