Implementing Ecommerce Methods
The _addTrans() Method
This method collects the primary order information and takes the following arguments: Order ID, Affiliation, Total, Tax, Shipping, City, State, Country. The order ID parameter from this method is used to link a transaction with the _addItem() method.
The _addItem() Method
This method collects all the product related information such as the name of the product, it's SKU, quantity, etc. For each item that the visitor purchases, you will have to call the _addItem() method and pass different parameters as listed above.
For example: If someone purchased two computers of the same make and model, then you will call the _addItem method just once.
The _trackTrans() Method
This method will be called at the very end of the process and it is used to send data to the Google Analytics server. Ecommerce data is sent separately from the visitor data using this _trackTrans method.
The implementation of these methods will vary depending on individual cases (e.g. based on Ecommerce platforms, coding structure, coding language, etc). Here is an example of what the code on your final receipt might look like:
Note: The values shown in the above example are what you will see if you view the source code on the receipt page after the transaction is completed. However, your website code will need to dynamically retrieve the values from your Ecommerce platform to populate these fields.