@blacksquareca/segment-shopify-checkout
v1.0.2
Published
Segment ecommerce checkout tracking for shopify
Downloads
2
Readme
@blacksquareca/segment-shopify-checkout
Forked from: https://github.com/broadlume/feathers
Tracks end of funnel E-Commerce data for your Shopify checkout.
Gather in-depth analytics about product information, checkout steps viewed, and purchases.
This package utilizes Segment.io to allow you to send data to any number of destinations including Google Analytics, Google Tag Manager and more.
Steps to install
- Go to your Shopify Checkout Theme and open the "Edit Code" dashboard. Open the
checkout.liquid
template file and add your Segment.io script within the<head>
tag like below:
<head>
<script type="text/javascript">
// insert your segment io script here
</script>
</head>
- Go to your Shopify Checkout Theme and open the "Edit Code" dashboard. Open the
checkout.liquid
template file and add the following to the end of the<body>
tag.
<div id="INSIGHT_CHECKOUT_TRACKING" style="display:none">
<div
id="checkout-data"
data-checkout-id="{{checkout.id}}"
data-order-number="{{checkout.order_number}}"
data-total-price="{{checkout.total_price}}"
data-currency="{{checkout.currency}}"
></div>
{% for item in checkout.line_items %}
<div
id="product-item-for-analytics-dataset"
data-name="{{item.title}}"
data-sku="{{item.sku}}"
data-price="{{item.price}}"
data-quantity="{{item.quantity}}"
data-url="{{item.url}}"
></div>
{% endfor %}
</div>
- Then add the following script to import this package and automatically send
analytic.track()
events populated with checkout data.
<html>
<body>
<!-- ...body contents here -->
</body>
</html>
<!-- Add this script in after the </html> -->
<script src="https://unpkg.com/@blacksquareca/segment-shopify-checkout"></script>
That's it!