Is your issue with setting the information on the Google Analytics tracker? Or is it actually determining what information to set on the tracker?
Or is the issue with getting information from the Google Analytics tracker or the Core Reporting API?
The GA tracker gets/sets the campaign information at the session level when the user initially arrives at your property, from the utm_* url parameters. The date/time of the event is determined by when you send the event to Google Analytics.
How you retrieve the transaction information to set it on the tracker is dependent on the ecommerce platform you use.
Is the problem that your users arrive at your confirmation page with out any of the transaction information, no transaction id in the in url parameter?
If you are simply trying figure out the current state of a field is on the tracker you get use the get method:
ga('create', 'UA-XXXXX-Y', 'auto');
ga(function(tracker) {
// Logs the campaign name.
console.log(tracker.get('campaignName'));
// Logs the campaign source.
console.log(tracker.get('campaignSource'));
// Logs the campaign medium.
console.log(tracker.get('campaignMedium'));
});
-Matt