Update 17th June 2016:
There is a new version of this code on http://www.briandorey.com/post/Google-Analytics-server-side-ecommerce-tracking-V2
A recurring issue we have on several of the ecommerce websites we manage is the Google Analytics Ecommerce Tracking system which often fails to save the customer’s order into the analytics account when the customers have completed their purchases.
This can be caused by the customer having ad blocking software installed or not returning to the online shop and viewing the order confirmation page which contains the Google tracking code.
Google have a server side system called Google Analytics Measurement Protocol API which allows you to post direct requests to the analytics servers to log events such as page views or other tracked events.