Shopify Segment integration

Littledata’s Shopify to Segment connection uses a combination of client-side (browser) and server-side tracking to ensure 100% accurate data about your Shopify store in Segment. Littledata automatically integrates with Shopify and Shopify Plus sites to capture every customer touchpoint, including sales, marketing, customer and product performance data.

Client-side (device mode) tracking

During the installation process, Littledata applies a tracking script to all pages (theme.liquid) under your Shopify store, except for the checkout steps:

  • Segment’s analytics.js library is loaded on all pages
  • Creates a littledataLayer data layer for all pages
  • Minified tracking code, hosted on a content delivery network (CDN)
  • Enables sending of client-side events to all Segment destinations which are enabled in ‘device mode’
  • Segment’s anonymous ID is passed to our servers to ensure consistent user journey tracking

Server-side (cloud mode) tracking

During the Segment connection setup flow in the app, Littledata also applies a set of webhooks to your Shopify store. This means that each time Shopify pings us back and confirms the user action we know which event has to be sent by our servers, ensuring 100% accuracy. There are many advantages to this approach:

  • Smaller script in the browser = faster page load
  • No extra scripts on the sensitive and secure checkout pages
  • Complete event capture for checkout flow, including sales and refunds/returns
  • Accurate marketing attribution (sessions stitched together)

Note: Using a headless Shopify setup? Follow the setup steps for headless Shopify tracking with Littledata.

What can you track

These are the events that Littledata sends from Shopify to Segment. These events will show up as tables in your warehouse, and as regular events in your other Segment destinations.

Client-side events

Client-side events tracked by Littledata, via Segment’s analytics.js library, and passed on to any destination enabled in device mode.

Event NameDescription
Page ViewedUser has viewed a page
Product List Viewed
User has viewed a product as they scroll down the collection page
Product ClickedUser has clicked a product within a product list
Product ViewedUser has viewed a product page
Product Image ClickedUser has clicked a product image
Product SharedUser has shared a product via social links
Thankyou Page Viewed
User has viewed the thank you page after completing an order *

* This is less reliable than the de-duplicated Order Completed event sent from Littledata’s servers, but you can use it in device-mode destinations to trigger a conversion. payment_method and shipping_method properties are not available with this event.

Server-side events

Note: Littledata’s Segment connection v2 was released in November 2020. Please reach out to our support team if you installed previously and now want the extra events

Server-side events are tracked by Littledata servers from Shopify and passed onto any destination in cloud mode.

Event NameDescription
Product AddedUser has added a product to the cart, and left it in the cart for more than 10 seconds
Product RemovedUser has removed a product from the cart
Checkout StartedUser has started checkout
Checkout Step ViewedUser has viewed a step in the checkout
Checkout Step CompletedUser has completed a step in the checkout
Customer CreatedUser added as a customer
Customer UpdatedCustomer information updated
Payment Info EnteredUser has entered payment info
Coupon AppliedSent with Checkout Step Completed or Order Completed when user has applied a coupon
Order CompletedCustomer has completed an web order (excluding iOS, Android, POS and draft orders)
Order RefundedWeb order has been refunded
Order Cancelled (v2)Admin has cancelled an order (including the cancel_reason)
POS Order Placed (v2)User has placed an order via Shopify POS
Payment Failure (v2)User completed checkout step 3 but the payment method failed (i.e. the card details were valid but the charge did not succeed)
Customer Enabled (v2)User has confirmed their email address and created a Shopify customer account with verified_email set as true
Fulfillment Created (v2)Order fulfillment is created (including status, tracking_numbers and tracking_urls where the shipping integration allows)
Fulfillment Updated (v2)Order fulfillment status has changed (including status, tracking_numbers and tracking_urls where the shipping integration allows)

User identity

In Littledata’s app you can choose which of the following fields you want to send as the userId for known customers:

  • Shopify Customer ID (default)
  • Email
  • MD5 email hash
  • None

For example, using ’email’ allows you to match users across platforms that do not have access to the Shopify Customer ID. For Segment Personas we also send shopify_customer_id as an externalID for advanced matching.

Identify calls

For every event where there is an identifiable Shopify customer (from both the client and the server) we also send an Identify call to trigger updates in CRM systems connected to Segment. This happens when the customer logs into the storefront, on the last step of the checkout, with the order, and also after purchase with any customer update in Shopify admin.

The following traits are included with an Identify call:

Property NameDescriptionProperty Type
userIdChosen user identifier, defaulting to Shopify Customer IDDouble
firstNameCustomer’s first nameString
lastNameCustomer’s last nameString
emailCustomer’s email addressString
phoneCustomer’s phone numberString
createdAtDate customer record was createdDate
descriptionCustomer notesString
addressCustomer’s primary addressString
customerLifetimeValueTotal spend of customer on the Shopify storeDouble
purchaseCountNumber of orders by this customerInteger
marketingOptInmarketing_opt_in field from Shopify customerString
tagsCustom tags applied to the customerString
stateWhether the customer account is enabled or disabledString
verified_email (v2)Whether the customer has verified their emailBoolean

Support for email marketing destinations

Email marketing platforms such as Klaviyo, Iterable and Hubspot require an email property with any server-side event in order to associate then with a customer (they cannot use an anonymous ID). Littledata’s adds that email property whenever an email address is set in the user traits() object (in device-mode) or from the Shopify customer record (in cloud-mode).

Alias calls

To support seamless customer tracking in analytics destinations such as Mixpanel, Vero and Kissmetrics, Littledata ensures the pre-checkout anonymousId is added as an alias of the userId (used from checkout step 2 onwards).

Event properties

These are the properties which may be included in the events listed above.

PropertyDescriptionProperty Type
userIdChosen user identifier, defaulting to Shopify Customer IDDouble
emailShopify email address (after checkout step 2), or email submitted on a storefront formString
order_idID of the orderString
checkoutIdID of the checkout sessionString
shippingShipping costFloat
taxOrder taxFloat
subtotalTotal excluding tax and shippingFloat
totalTotal value of the orderFloat
affiliationAffiliation of the orderString
coupon
Comma-separated string of discount coupons used, if applicable
String
currencyCurrency of the orderString
discountDiscounted amountFloat
productsList of all the products at that stage of the funnel *Array
stepCheckout stepInteger
payment_method
Payment gateway used in the checkoutString
shipping_methodShipping method chosen for checkoutString
context[‘Google Analytics’].clientIdUser’s Google Analytics Client IDString
context[‘Google Analytics’].geoidUser’s locationString
context.uipUser IP addressString
sent_fromUnique property to identify events sent by LittledataString
presentment_currencyUser’s local currencyString
presentment_totalOrder total in local currencyString
* Prior to 1st February 2021, products on Product Added and Product Removed events only contained the single product, not the whole cart.

Product properties

Each product in the products array, or Product Viewed and Product Added events, will have the following properties

PropertyDescriptionProperty Type
product_idShopify product IDString
skuProduct SKUString
shopify_product_idAlso Shopify product IDString
shopify_variant_idShopify variant IDString
variantProduct variant nameString
nameProduct nameString
categoryCategory of the product (defaults to all)String
brandBrand of the productString
list_idID of the product collection (for Product List Views and Product Clicks)String
list_nameName of the product collection (for Product List Views and Product Clicks)String
list_positionProduct position in the collection (for Product List Views and Product Clicks)Integer
priceProduct priceFloat
quantityQuantity of this productInteger

Subscription ecommerce events

Additional events available via Littledata’s ReCharge connection,  and available in cloud mode destinations.

Event NameDescription
Subscription CreatedCustomer has created a subscription
Subscription UpdatedCustomer has updated a subscription
Subscription CancelledCustomer has cancelled a subscription
Order ProcessedRecurring order has been processed
Charge FailedFailed to charge customer
Charge Max Tries ReachedMaximum tries to charge customer has been reached
Payment Method UpdatedCustomer has updated the payment method
Customer UpdateCustomer information updated

Advanced device-mode settings

You can edit the LittledataLayer object in your Shopify theme to manually change these advanced settings. For more information, see the Shopify tracker GitHub repository.

cookiesToTrack

Any cookie set on a landing page (e.g. a session identifier or marketing campaign name) can be sent on to Segment with an identify call.

CDNForAnalyticsJS

If you have a proxy CDN setup  to load Segment’s AnalyticsJS library from your own domain you can specify it here.