google analytics - Send enhanced ecommerce data -
when land on confirmation page run following code.
var purchaseobject = { 'id': $orderid, 'revenue': $total, 'shipping': $deliverycost }; if (couponcode.length) { purchaseobject['coupon'] = couponcode; } ga('ec:setaction', 'purchase', purchaseobject); ga('ec:send');
both sends generates error messages.
plugin "ec" not have method "send".
and
error calling plugin method: {0: "ec:send"}
i have added
ga('require', 'ec');
in head , other events works don't why send not work.
eec not have send method, set action e-commerce-data , send along next pageview (or other interaction). see example google documentation:
// transaction level information provided via actionfieldobject. ga('ec:setaction', 'purchase', { 'id': 't12345', 'affiliation': 'google store - online', 'revenue': '37.39', 'tax': '2.85', 'shipping': '5.34', 'coupon': 'summer2013' // user added coupon @ checkout. }); ga('send', 'pageview'); // send transaction data initial pageview.
notice last comment - transaction sent pageview. if not want pageview, use event.
Comments
Post a Comment