Lead Gen & CRM
How can we help you?
Search our help articles, video tutorials, and quickstart guides

You've got this. You've got us. Search our Knowledge Base to quickly find answers to your questions.

Shopping Cart Integration Overview

Article: 000050289
Updated: July 18, 2024

Measure which campaigns are creating the most transactions from your online store

Lead Gen & CRM's Shopping Cart Integration allows you to automatically record web transactions from your online store and attribute those sales to Lead Gen & CRM Campaigns. This enables you to measure your end-to-end marketing ROI for eCommerce-based businesses.


Article Contents

 
 
Users:
Administrators 
Company Managers 
Marketing Managers  
Sales Managers 
Salespersons 
Jr. Salespersons 


Accessing the Shopping Cart

The Shopping Cart feature allows you to measure which campaigns are creating the most online transactions, providing you with a way to make better marketing decisions.

After integrating a shopping cart and running at least one transaction, the Cart page will become accessible. This page is where you can access information for all of your online transactions. Click Connections > eCommerce in the left toolbar to access the Shopping Cart.

Note: Shopping Cart is not available when Salesforce Sync is active.



Understanding the Shopping Cart

The Shopping Cart page displays all of your recent transactions, as well as any historical transactions, and includes information on:

  • The name and email address of the purchasing lead
  • When the transaction occurred
  • The details of items sold during the transaction
  • The total purchase value




Clicking on either the total number or the product icon will display the details for that transaction.


 

If a lead completes a web transaction and is associated with a Lead Gen & CRM campaign, you will see their sales attributed back to that individual marketing tactic on the Campaign Insights page.


 

 



Setting Embedded Code

In order to record your eCommerce transactions as Closed Won Opportunities in Lead Gen & CRM, 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 Lead Gen & CRM 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. 

Note: Constant Contact offers Professional Services to assist with custom coding.


Creating Transaction Objects

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.


Adding Items to Transactions

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.


Completing Transactions

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.
 



Example Shopping Cart Code

The following is an example of basic embedded code.
 

<script type="text/javascript">
  var _ss = _ss || [];
    _ss.push(['_setDomain', 'https://koi-XXXXXXXXXX.marketingautomation.services/net']);
    _ss.push(['_setAccount', 'KOI-XXXXXXXXX']);
    _ss.push(['_trackPageView']);
    (function() {
  var ss = document.createElement('script');
    ss.type = 'text/javascript'; ss.async = true;
    ss.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'koi-3Q4K3MJUEA.marketingautomation.services/client/ss.js?ver=1.1.1';
  var scr = document.getElementsByTagName('script')[0];
    scr.parentNode.insertBefore(ss, scr);
})();
</script>

 

The following example code reflects what complete shopping cart code looks like. This code should go after embedded code. Shopping cart code can only be placed on tracked pages.
 

<script type='text/javascript'>
   // Example of how to send a transaction. Must be run AFTER the first 2 push calls (_setDomain, _setAccount)
    _ss.push(['_setTransaction', {
        'transactionID': '1234',
        'storeName': '*** Acme Test Co. ***',
        'total': '28.38',
        'tax': '1.29',
        'shipping': '15.00',
        'city': 'San Jose',
        'state': 'California',
        'zipcode': '32608',
        'country': 'USA',
        // 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' : 'john.smith@gmail.com', // optional parameter
        'cartUrl': 'https://www.shopify.com/your/cart' // optional parameter
    }]);
    _ss.push(['_addTransactionItem', {
        'transactionID': '1234',
        'itemCode': 'DD44',
        'productName': 'T-Shirt',
        'category': 'Olive Medium',
        'price': '11.99',
        'quantity': '1',
        'productURL': 'https://yourcompany.com/olivemedium/tshirt', // optional parameter
        'imagePath' : 'https://yourcompany.com/olivemedium/tshirt.png' // optional parameter
    }]);
    _ss.push(['_completeTransaction', {
        'transactionID': '1234'
    }]);
</script>
 


Did this article answer your question?


Constant Contact Logo

Copyright © 2025 · All Rights Reserved · Constant Contact · Privacy Center