1jQuery(document).ready(function($) { 2 3 // Initialize 4 typeof window.ga !== "undefined" && (rs_initialize_ga_tracking()); 5 6 // Main 7 function rs_initialize_ga_tracking() { 8 // ga is a global from Google Analytics 9 ga(function (tracker) { 10 rs_set_ga_tracker(tracker); 11 rs_register_link_handlers(); 12 13 // Setup tracking idea globally in case we need to reference it 14 function rs_set_ga_tracker() { 15 window.rs_ga_client_id = tracker.get('clientId'); 16 window.rs_ga_tracking_id = tracker.get('trackingId'); 17 } 18 }); 19 } 20 21 // Setup RG link handlers 22 function rs_register_link_handlers() { 23 $('.rs-register-link a, .rs-show-register-link a').click(function (e) { 24 if (window.rs_ga_client_id && window.rs_ga_tracking_id && $('.rs-registration-external').length == 0) { 25 e.preventDefault(); 26 location.href = $(this).prop('href') + '&ga-client-id=' + encodeURI(window.rs_ga_tracking_id) 27 + encodeURI('~') + encodeURI(window.rs_ga_client_id); 28 } 29 }); 30 } 31 32});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.