स्पार्कबॉक्स में इस स्निपेट को यह पता लगाने में मदद करने के लिए है कि कितनी बार ब्राउज़र विंडोज़ वास्तव में आकार परिवर्तन किए जाते हैं।
(function() ( var resizeTimer; // Assuming we have jQuery present $( window ).on( "resize", function() ( // Use resizeTimer to throttle the resize handler clearTimeout( resizeTimer ); resizeTimer = setTimeout(function() ( /* Send the event to Google Analytics * * https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApiEventTracking * _trackEvent(category, action, opt_label, opt_value, opt_noninteraction) */ var $window = $( window ); _gaq.push( ( "_trackEvent", "User Actions", "Browser Resize", $window.width() + " x " + $window.height() ) ); ), 1000); )); ))();
ध्यान दें कि Google Analytics में घटनाओं को ट्रैक करना कितना आसान है। यह सिर्फ कुछ के बारे में इस्तेमाल किया जा सकता है।