Sorry, I've been a bit busy and also trying some of the methods listed here. My implementation is basically a JS script that inserts a script into the top of <body> using a jQuery prepend function, referencing a JS variable that is essentially the entire script, 'escaped.' Then later on in the main script (not the one inserted), I have logic that checks for values and sends push events as necessary, using methods and functions that were defined in the inserted script. The logic for sending off a push event for a purchase is currently as follows (whole thing executes on DOM Ready): //eCom sale submission event if (utag.data.order_id != "") { $CVO.push(['trackEvent', { type: 'ecom-sale-raw', id: utag.data.order_id, amount: utag.data.order_subtotal }]); I don't believe there are any issues with it sending blanks. Instead, the only issue is that it doesn't seem to always be picking up transactions, since GA sometimes shows up to 25-30% more transactions (and their IDs). That suggests a timing issue. Currently I am trying a method that was suggested above, and that is to execute a 1000ms setTimeout on the checks for these values. I'm pretty sure this is all a timing issue, but I'm just not totally sure the best way to tackle it, since there's no such thing as a 'variable population listener'. Another thought I've had (but have not tested yet) is to split this out into 2 scripts --- the script that inserts the script at top of body, and then another script that inserts the logic checks at the bottom of <body>. I don't think that'll work any better than the 1000ms setTimeout though.
... View more