Integrating with Lead Gen & CRM's shopping cart allows you to automatically record web transactions from your online store and attribute those sales to Lead Gen & CRM leads and campaigns.
This enables you to measure your end-to-end marketing ROI for eCommerce-based businesses directly in Lead Gen & CRM.
There are many different eCommerce platforms out there, such as Shopify, Magento, and WooCommerce. This article will detail the process to integrate your shopping cart with Shopify.
Article Contents
Trial | ||
Essential | ✓ | |
Advanced | ✓ | |
Ultimate | ✓ |
Administrators | ✓ | |
Company Managers | ||
Marketing Managers | ||
Sales Managers | ||
Salespersons | ||
Jr. Salespersons |
Integrating Shopify
In order to integrate Lead Gen & CRM with Shopify, you must have administrator access to both your Shopify and Lead Gen & CRM accounts.
To add the necessary code that needs to be placed in the Additional Scripts setting in Shopify, do the following:
- Log in to Shopify as an administrator.
- Click Settings > Checkout.
- Locate the Additional Scripts text box under the Order Processing section.
- Paste the tracking code of your domain associated to this shopping cart in the text area.
- Paste the following code below where you placed the tracking code:
Click to enlarge.
Important: While Shopping Cart Abandonment was created to work with a variety of platforms, the implementation and ease of use will vary by platform. Lead Gen & CRM recommends having a developer handle implementing abandonment.
Note: Constant Contact offers Professional Services to assist with custom coding.
<script type='text/javascript'>
_ss.push(['_setTransaction', {
'transactionID': '{{ order.order_number }}',
'storeName': '{{ shop.name }}',
'total': '{{ order.total_price | money_without_currency }}',
'tax': '{{ order.tax_price | money_without_currency }}',
'shipping': '{{ order.shipping_price | money_without_currency }}',
'city': '{{ order.billing_address.city }}',
'state': '{{ order.billing_address.province }}',
'zipcode': '{{ order.billing_address.zip }}',
'country': '{{ order.billing_address.country }}',
'firstName' : '{{ order.customer.first_name }}',
'lastName' : '{{ order.customer.last_name }}',
'emailAddress' : '{{ order.customer.email }}'
}]);
{% for line_item in order.line_items %}
_ss.push(['_addTransactionItem', {
'transactionID': '{{ order.order_number }}',
'itemCode': '{{ line_item.product_id }}',
'productName': '{{ line_item.product.title }}',
'category': 'General',
'price': '{{ line_item.product.price | money_without_currency }}',
'quantity': '{{ line_item.quantity }}'
}]);
{% endfor %}
_ss.push(['_completeTransaction', {
'transactionID': '{{ order.order_number }}'
}]);
</script>
While this will work as-is for most users, others may need to have a developer modify it slightly, as some Shopify configurations may require the use of different variables. In that case, this is still an excellent starting point with most of the work done.
Example Code
The following code is an example of a complete code snippet that will integrate your Lead Gen & CRM Shopping Cart with Shopify. Make sure to include the tracking code for your domain at the top of the snippet, as the tracking code in this code snippet is an example and must be replaced with your tracking code.
<script type="text/javascript">
var _ss = _ss || [];
_ss.push(['_setDomain', 'https://koi-XXXXXXXXXX.marketingautomation.services/net']);
_ss.push(['_setAccount', 'KOI-XXXXXXXXXX']);
_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-3QN8DY6N0K.marketingautomation.services/client/ss.js?ver=1.1.1';
var scr = document.getElementsByTagName('script')[0];
scr.parentNode.insertBefore(ss, scr);
})();
</script>
// Some variables may need to be changed depending on checkout process
<script type='text/javascript'>
_ss.push(['_setTransaction', {
'transactionID': '{{ order.order_number }}',
'storeName': '{{ shop.name }}',
'total': '{{ order.total_price | money_without_currency }}',
'tax': '{{ order.tax_price | money_without_currency }}',
'shipping': '{{ order.shipping_price | money_without_currency }}',
'city': '{{ order.billing_address.city }}',
'state': '{{ order.billing_address.province }}',
'zipcode': '{{ order.billing_address.zip }}',
'country': '{{ order.billing_address.country }}',
'firstName' : '{{ order.customer.first_name }}',
'lastName' : '{{ order.customer.last_name }}',
'emailAddress' : '{{ order.customer.email }}'
}]);
{% for line_item in order.line_items %}
_ss.push(['_addTransactionItem', {
'transactionID': '{{ order.order_number }}',
'itemCode': '{{ line_item.product_id }}',
'productName': '{{ line_item.product.title }}',
'category': 'General',
'price': '{{ line_item.product.price | money_without_currency }}',
'quantity': '{{ line_item.quantity }}'
}]);
{% endfor %}
_ss.push(['_completeTransaction', {
'transactionID': '{{ order.order_number }}'
}]);
</script>