From d930799df371b04902287444de6fe1e156a0ede9 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Mon, 23 Sep 2013 16:34:04 -0700 Subject: [PATCH] Give GA 500ms to send out gold flow tracking pixels. --- r2/r2/public/static/js/analytics.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/r2/r2/public/static/js/analytics.js b/r2/r2/public/static/js/analytics.js index f5f0568a0..6683c53be 100644 --- a/r2/r2/public/static/js/analytics.js +++ b/r2/r2/public/static/js/analytics.js @@ -141,8 +141,13 @@ r.analytics = { // If GA is loaded, have GA process form submission after firing // (and cancel the default). _gaq.push(['_trackPageview', '/gold/external/' + vendor]) - _gaq.push(function(){ form.submit() }) - + _gaq.push(function() { + // Give GA half a second to send out its pixel. + setTimeout(function() { + form.submit() + }, 500) + }) + if (_gat && _gat._getTracker){ // GA is loaded; form will submit via the _gaq.push'ed function event.preventDefault()