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

    (@okoth1)

    This should work.

    <!--Begin Real Time on Site and Bounce Rate -->
    <script>
    var _gaq = _gaq || [];
    (function (tos) {
    window.total_time = 0;
    window.setInterval(function () {
    total_time += 10;
    tos = (function (t) {
    return t[0] == 50 ? (parseInt(t[1]) + 1) + ':00' : (t[1] || '0') + ':' + (parseInt(t[0]) + 10);
    })(tos.split(':').reverse());
    if (window.total_time <= 300) {
    window.pageTracker ? pageTracker._trackEvent('Time', 'Log', tos) : _gaq.push(['_trackEvent', 'Time', 'Log', tos]);
    }
    }, 30000);
    })('00');
    </script>
    <!--End Real Time on Site and Bounce Rate -->
    Thread Starter Eric Potratz

    (@epotratz)

    Thanks for the reply.

    I seem to have gotten it to work with the below code. I really just needed to see if readers where on the page for longer than 30 seconds. The 10 second events was overwhelming my event report. I couldn’t get any good data out of it in the events section.

    Although its not really the plugin’s intended purpose, its been s great starting point!

    <!--Begin Real Time on Site and Bounce Rate -->
    <script>
    var _gaq = _gaq || [];
    (function (tos) {
    window.total_time = 0;
    window.setInterval(function () {
    total_time += 30;
    tos = (function (t) {
    return t[0] == 30 ? (parseInt(t[1]) + 1) + ':00' : (t[1] || '0') + ':' + (parseInt(t[0]) + 30);
    })(tos.split(':').reverse());
    if (window.total_time <= 30) {
    window.pageTracker ? pageTracker._trackEvent('reading_blog', 'Log', '30+_second_blog_reading') : _gaq.push(['_trackEvent', 'reading_blog', 'Log', '30+_second_blog_reading']);
    }
    }, 30000);
    })('00');
    </script>
    <!--End Real Time on Site and Bounce Rate -->
    Plugin Author Okoth1

    (@okoth1)

    Excellent! Thanks for posting.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to change the code to fire every 30 seconds?’ is closed to new replies.