var _gaq = _gaq || []; _gaq.push( ['_setAccount', 'UA-47761645-1'], ['_setDomainName', '.buydomains.com'], ['_setAllowLinker', true], ['_trackPageview'], ['_trackPageLoadTime'], ['b._setAccount', ''], ['b._setDomainName', '.buydomains.com'], ['b._setAllowLinker', true], ['b._trackPageview'], ['b._trackPageLoadTime'] ); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('http:' == document.location.protocol ? 'http://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); /** IP Address tracking for BOT identification */ _gaq.push(['_setCustomVar', 1, 'IP', '203.135.187.11', 1]); /** * custom event and page tracking helper functions */ var customGATracking = { /** track a specific event then redirect to new location if needed */ eventTrack: function(cat,act,val,follow) { console.log('Google Analytics Event Track [CAT: ' + cat + '] [ACT: ' + act + '] [VAL: ' + val + '] [FOLLOW: ' + follow + ']'); if (!follow) var follow = false; _gaq.push(['_trackEvent',cat,act,val]); if (follow !== false) { window.location = follow; return false; } }, /** track a custom page view */ pageTrack: function(uri) { console.log('Google Analytics Page Track [URI: ' + uri + ']'); _gaq.push(['_trackPageview', uri]); }, /** track specific links being clicked */ linkEvent : function(cat, act, val, uri) { console.log('Google Analytics Link Event Track [CAT: ' + cat + '] [ACT: ' + act + '] [VAL: ' + val + '] [URI: ' + uri + ']'); customGATracking.eventTrack(cat, act, val); setTimeout(function() { window.location = uri; }, 500); return false; }, gaStartTime: false, gaTimer: {'start':0,'end':0}, gaTrackTiming: function(event,category,el,label) { var endTime = new Date().getTime(); var timeSpent = endTime - customGATracking.gaStartTime; console.log('Google Analytics Track Timing [EVENT: ' + event + '] [CATEGORY: ' + category + '] [EL: ' + el + '] [LABEL: ' + label + ']'); ga('send', 'timing', category, el, timeSpent, label); }, gaStartTiming: function() { console.log('Google Analytics START to Track Timing'); customGATracking.gaStartTime = new Date().getTime(); }, startTimer: function() { console.log('Google Analytics START Timing'); customGATracking.gaTimer['start'] = new Date().getTime(); }, endTimer: function(cat,el) { customGATracking.gaTimer['end'] = new Date().getTime(); var tdiff = customGATracking.gaTimer['end'] - customGATracking.gaTimer['start']; console.log('Google Analytics END Timing [CATEGORY: ' + cat + '] [EL: ' + el + '] [TIME DIFF: ' + tdiff + ']'); _gaq.push(['_trackTiming',cat,el,tdiff]); } }