Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def google_analytics_real_bounce_rate_fix(timeout = 10)
- name = "NoBounce"
- msg = "Over #{timeout} seconds"
- ms = timeout * 1000
- <<-JS
- function disqualifyAsBounce() {
- pageTracker._trackEvent('#{name}', '#{name}', '#{msg}');
- }
- setTimeout("disqualifyAsBounce()", #{ms});
- JS
- end
- # Usage:
- # Output the method's return value RIGHT AFTER the call to '_trackPageView'.
- # Example - Your JS has to look like this (variables may vary):
- #
- # <script type="text/javascript">
- # try {
- # var pageTracker = _gat._getTracker("UA-XXXXXXX-XX");
- # pageTracker._trackPageview();
- # function disqualifyAsBounce() {
- # pageTracker._trackEvent('NoBounce', 'NoBounce', 'Over 10 seconds');
- # }
- # setTimeout("disqualifyAsBounce()", 10000);
- #
- # } catch(err) {}
- # </script>
Add Comment
Please, Sign In to add comment