Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // definition of trackEvent method on a global object
- $3N = {
- trackEvent : function(category, action, label, value){
- if (typeof(pageTracker) == "object") pageTracker._trackEvent(category, action, label, value);
- else if(typeof(_gaq) == "object") _gaq.push(['_trackEvent', category, action, label, value]);
- }
- };
- // example of using trackEvent in my onerror helper (which you may also want to use)
- window.onerror = function(msg, url, linenumber){
- var handle_error = function(msg, url, linenumber) {
- $3N.trackEvent(
- "Error",
- msg,
- navigator.userAgent,
- linenumber
- );
- };
- if ($3N.dom_ready)
- handle_error(msg, url, linenumber);
- else
- window.addEvent('domready', handle_error.bind(window, [msg, url, linenumber]));
- };
- window.addEvent('domready', function() { $3N.dom_ready = true; });
Add Comment
Please, Sign In to add comment