In order to record your eCommerce transactions as Closed Won Opportunities in SharpSpring, you will need to be familiar with the three calls that go after (or are executed after) your embedded code. The process for tracking eCommerce through SharpSpring is dictated by these three calls. They are described below in the order in which you should insert them within your shopping cart or eCommerce software.
Create a transaction object
Use the _setTransaction method to initialize a transaction object. The transaction object stores all the related information about a single transaction, such as the transaction ID, shipping charges, and billing address. This information is all pulled from the transaction ID, which will be the same value for a given transaction and all items associated with it.
In the event that an email address is supplied as part of the _setTransaction payload, a lookup will be performed to determine if a matching record is available for that email address. If a matching record is located, the record's data may be optionally updated by supplying an additional firstName and/or lastName parameter.
If a matching record is not located for a supplied email address, a new record will be created automatically and may optionally be populated with any firstName and/or lastName data that is supplied. Regardless of whether an update or creation event results from including an email address in the payload, the user's tracking cookie will automatically associate with the email address supplied, and any subsequent transactions will be associated with the appropriate contact record.
Add items to the transaction
The _addTransactionItem method tracks information about each individual item in the user's shopping cart and associates the item with each transaction via the transactionId field. This method tracks the details about a particular item, such as SKU, price, category, and quantity.
Tell SharpSpring the transaction is complete
The _completeTransaction method confirms that a purchase has occurred, and all data that has been built up in the transaction object is finalized as a transaction and saved as a closed opportunity.
How to make changes to your tracking code.
var _ss = _ss || ;
var ss = document.createElement('script');
ss.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'koi-724KI.sharpspring.com' + '/client/ss.js';
var scr = document.getElementsByTagName('script');
// Example of how to send a transaction. Must be run AFTER the first 2 push calls (_setDomain, _setAccount)
'storeName': 'Acme Test Co.',
'city': 'San Jose',
// the following params can be used for creating/updating
// a contact in the context of the supplied transaction data.
// if this data is omitted, the underlying contact/tracking data
// associated with the visitors browser session is used automatically.
'firstName' : 'John', // optional parameter
'lastName' : 'Smith', // optional parameter
'emailAddress' : 'firstname.lastname@example.org' // optional parameter
'category': 'Olive Medium',
'productURL': 'https://yourcompany.com/olivemedium/tshirt', // optional parameter
'imagePath' : 'https://yourcompany.com/olivemedium/tshirt.png' // optional parameter