Many Shopify merchants use Carthook to increase customer Average Order Value and increase conversion rates. ShopMessage works well with Carthook with some configuration
Why You Need an Integration with Carthook
ShopMessage works by first tracking actions your customers take on your site via ViewProduct
, UpdateCart
, and PurchaseComplete
events, and then sending relevant Messenger flows. Usually PurchaseComplete
works automatically when using the native Shopify Checkout. However, when using Carthook, you will need to configure Carthook to send the PurchaseComplete
events when users land on an Upsell or Thank You page.
Step by Step Instructions
1. Locate your store's paste snippet.
Log into your ShopMessage dashboard and click on "Settings", then "Site". You will find a paste snippet which you will need later. If you are a Shopify site, it might be under a section called "Advanced Library Installation".
2. Log into Carthook and visit the Global Code screen
3. Paste in the Carthook Integration Code into the "Global Javascript" section.
Be sure to insert your own site hash where it says REPLACE WITH YOUR SHOPMESSAGE SITE HASH
Here is the code:
<!-- START SHOPMESSAGE -->
<script type="text/javascript">
/* replace this script with the snippet from your ShopMessage Dashboard*/
</script>
<!-- END SHOPMESSAGE -->
<!-- SHOPMESSAGE SCRIPT for Carthook Upsell, Downsell, TY pages -->
<script type="text/javascript">
// Please only put this on upsell/downsell/ty pages
if (window.chData.order && window.chData.order.lastChargedLineItems) {
let order = window.chData.order;
let lastChargedLineItems = order.last_charged_line_items;
let items = [];
lastChargedLineItems.forEach(function(el) {
items.push({
"id": el.id,
"quantity": el.quantity,
"price": el.price,
"title": el.title
});
});
if (items.length > 0) {
_shopmsg('trigger', 'PurchaseComplete', {
"platform": "CartHook",
"total_price": order.total_price,
"subtotal_price": order.subtotal_price,
"currency": order.currency,
"order_id": order.order_id || order.carthook_order_id,
"cart_token" : order.token,
"items" : items,
"customer_properties" : order.customer,
"shipping_address" : order.shipping_address,
"carthook_order" : order // track the full Carthook order to be used as a fallback
});
}
}
</script>
<!-- END Carthook Upsell, Downsell, TY pages -->
4. A note about order IDs.
When a customer places an order and lands on an Upsell page, they don't have an order_id
, but instead have a carthook_order_id
. Then, when the user gets to the Thank You page, the Shopify order_id
is created. For this reason, if a customer places the initial order and also purchases an upsell, they will be reported to ShopMessage as two separate orders.
5. That's it!
You can test your integration by opening the Live View in your ShopMessage dashboard, making a test purchase through Carthook and verifying that the PurchaseComplete
event appears.
Have any questions? Reach out to us using the Intercom chat bubble in the bottom right.