Skip to contentSkip to navigationSkip to topbar
Page tools
Useful for sharing or LLM
Accelerate development with AI

On this page
Looking for more inspiration?Visit the

Shopify


This Shopify Source lets you send Shopify Web Pixel API Standard Events(link takes you to an external page) from your Shopify Store to Segment. Events sent to Segment are formatted to match the Segment Ecommerce Spec.

This Source is a free Shopify App Extension(link takes you to an external page) which can be installed using your Shopify Store's Admin interface.


Overview

overview page anchor

Once installed and enabled, Segment collects events from the user's browser and sends them to your Segment 'Shopify' Source in real time.

  • You can control which Segment track() events get collected as well as how user profile details are passed to Segment.
  • A custom JavaScript snippet is loaded in the Shopify store. This script transforms Shopify Standard Events to Segment Ecommerce Spec events. Note that Segment's Analytics.js 2.0 library will not load on any Shopify store page.
  • This is a Device Mode (client side) Integration. No data is sent server-side from Shopify to Segment.
  • This source does not collect post-purchase events.
  • The Segment anonymousId is set to the value of the Shopify client ID. The Segment userId value is never populated.
  • Email address and phone number details are sent to Segment if they are collected by Shopify.

If you require more advanced functionality or want to collect post-purchase events, consider using the Shopify by Littledata Source. Shopify by Littledata requires a paid subscription.


To set up the Shopify Source, follow these steps:

  1. Log in to your Segment Workspace.
  2. Click on 'Catalog'.
  3. Use the 'Search an Integration' search field to search for the term 'Shopify'.
  4. Select the 'Shopify' tile and complete the steps to set it up.
  5. Make a note of the Source write key for your Shopify Source.
  6. Log in to your Shopify Store account.
  7. Go to the Shopify app store listing for Twilio Segment.
  8. Click Add app to begin the installation process.
  9. Add the Segment write key for your Segment Source, and select the Region for your Segment Workspace.
  10. Use the checkboxes under 'Manage Events' to select which track() events to send to Segment.
  11. Use the checkboxes under 'Manage user profile details' to select how user profile details should be sent to Segment.
  12. Click the 'Turn On' button to enable start sending analytics events from your Shopify Store to Segment.

  • anonymousId - The Segment anonymousId field are populated with the Shopify client ID. The Shopify client ID is a 'client-side ID of the customer, provided by Shopify'. You cannot configure the Segment anonymousId to be populated with any other value.
  • userId - The Segment userId field does not populate. You cannot configure the userId to be populated with any value from Shopify.
  • email and phone - traits.email and traits.phone are collected using Identify events (unless explicitly disabled in the 'Manage user profile details' section of the Shopify App User Interface).

Track and Page events sent to Segment

track-and-page-events-sent-to-segment page anchor

See the Shopify Standard Events(link takes you to an external page) documentation for more information about when events are triggered.

Segment Event NameShopify Standard Event NameEvent trigger
Page Viewedpage_viewedA user has visited a page. Sent as a Segment Page event
Products Searchedsearch_submittedA user has performed a search on the Shopify storefront
Product List Viewedcollection_viewedA user has visited a product collection index page
Product Viewedproduct_viewedA user has visited a product details page
Product Addedproduct_added_to_cartA user has added a product to their cart
Product Removedproduct_removed_from_cartA user has removed a product from their cart
Cart Viewedcart_viewedA user has visited the cart page
Checkout Startedcheckout_startedA user has started the checkout process
Shipping Info Enteredcheckout_shipping_info_submittedA user has chosen a shipping rate
Address Info Enteredcheckout_address_info_submittedA user has submitted their mailing address
Contact Info Enteredcheckout_contact_info_submittedA user has submitted a checkout form
Payment Info Enteredpayment_info_submittedA user has submitted their payment information
Order Completedcheckout_completedA user has completed a purchase

You can control which Track and Page events to send to Segment in the 'Manage events' section of the Shopify App User Interface.

Manage events settings with options for standard analytics events like Page Viewed and Checkout Started.

The fields below are automatically sent to Segment with every Track, Page and Identify event. For Page events, these fields are also included in the properties object.

FieldDescriptionType
context.page.urlThe entire URL of the pageString
context.page.searcha string containing a '?' followed by the parameters or "querystring" of the URLString
context.page.patha string containing an initial '/' followed by the path of the URL, excludes the query stringString
context.page.titleThe title of the current pageString
context.page.referrerURI of the page that linked to the current pageString

The fields below are automatically sent to Segment with every Track, Page and Identify call, if present in the QueryString of the page url.

FieldDescriptionType
context.campaign.sourceutm_source QueryString valueString
context.campaign.mediumutm_medium QueryString valueString
context.campaign.nameutm_campaign QueryString valueString
context.campaign.termutm_term QueryString valueString
context.campaign.contentutm_content QueryString valueString

Page Viewed / Page event properties

page-viewed--page-event-properties page anchor

The properties below are included with Page events.

(information)

Missing properties?

Your Segment events may be missing one of the following properties if Shopify provides null or an empty value for a property.

FieldDescriptionType
urlThe entire URL of the pageString
searcha string containing a '?' followed by the parameters or "querystring" of the URLString
patha string containing an initial '/' followed by the path of the URL, excludes the query stringString
titleThe title of the current pageString
referrerURI of the page that linked to the current pageString

Product Viewed Track event properties

product-viewed-track-event-properties page anchor

The properties below are included with Product Viewed Track events.

(information)

Missing properties?

Your Segment events may be missing one of the following properties if Shopify provides null or an empty value for a property.

PropertyDescriptionType
product_idUnique ID for the productString
nameThe product nameString
untranslated_nameUntranslated name of the productString
variantThe product variantString
untranslated_variantUntranslated product variantString
categoryProduct type specified by the merchantString
brandThe product's vendor nameString
urlURL to the product pageString
image_urlURL to the product imageString
currencyThe three-letter code that represents the currency, for example 'USD'String
priceThe decimal money amount (price) for the productNumber
skuThe SKU (stock keeping unit) associated with the variantString

Product Added and Product Removed Track event properties

product-added-and-product-removed-track-event-properties page anchor

The properties below are included with Product Added and Product Removed Track events.

(information)

Missing properties?

Your Segment events may be missing one of the following properties if Shopify provides null or an empty value for a property.

PropertyDescriptionType
product_idUnique ID for the productString
nameThe product nameString
untranslated_nameUntranslated name of the productString
variantThe product variantString
untranslated_variantUntranslated product variantString
categoryProduct type specified by the merchantString
brandThe product's vendor nameString
urlURL to the product pageString
image_urlURL to the product imageString
currencyThe three-letter code that represents the currency, for example 'USD'String
priceThe decimal money amount (price) for the productNumber
quantityThe quantity of the merchandise that the customer intends to purchaseInteger
total_priceThe total decimal money amount (price) for the productNumber
skuThe SKU (stock keeping unit) associated with the variantString

Product List Viewed Track event properties

product-list-viewed-track-event-properties page anchor

The properties below are included with Product List Viewed Track events. products.$. indicates an array named 'products'.

(information)

Missing properties?

Your Segment events may be missing one of the following properties if Shopify provides null or an empty value for a property.

PropertyDescriptionType
products.$.product_idUnique ID for the productString
products.$.nameThe product nameString
products.$.untranslated_nameUntranslated name of the productString
products.$.variantThe product variantString
products.$.untranslated_variantUntranslated product variantString
products.$.categoryProduct type specified by the merchantString
products.$.brandThe product's vendor nameString
products.$.urlURL to the product pageString
products.$.image_urlURL to the product imageString
products.$.currencyThe three-letter code that represents the currency, for example 'USD'String
products.$.priceThe decimal money amount (price) for the productNumber
products.$.skuThe SKU (stock keeping unit) associated with the variantString

Products Searched Track event properties

products-searched-track-event-properties page anchor

The properties below are included with Products Searched Track events. products.$. indicates an array named 'products'.

(information)

Missing properties?

Your Segment events may be missing one of the following properties if Shopify provides null or an empty value for a property.

PropertyDescriptionType
products.$.product_idUnique ID for the productString
products.$.nameThe product nameString
products.$.untranslated_nameUntranslated name of the productString
products.$.variantThe product variantString
products.$.untranslated_variantUntranslated product variantString
products.$.categoryProduct type specified by the merchantString
products.$.brandThe product's vendor nameString
products.$.urlURL to the product pageString
products.$.image_urlURL to the product imageString
products.$.currencyThe three-letter code that represents the currency, for example 'USD'String
products.$.priceThe decimal money amount (price) for the productNumber
products.$.skuThe SKU (stock keeping unit) associated with the variantString
queryThe search query that was executedString

Cart Viewed Track event properties

cart-viewed-track-event-properties page anchor

The properties below are included with Cart Viewed Track events. products.$. indicates an array named 'products'.

(information)

Missing properties?

Your Segment events may be missing one of the following properties if Shopify provides null or an empty value for a property.

PropertyDescriptionType
products.$.product_idUnique ID for the productString
products.$.nameThe product nameString
products.$.untranslated_nameUntranslated name of the productString
products.$.variantThe product variantString
products.$.untranslated_variantUntranslated product variantString
products.$.categoryProduct type specified by the merchantString
products.$.brandThe product's vendor nameString
products.$.urlURL to the product pageString
products.$.image_urlURL to the product imageString
products.$.currencyThe three-letter code that represents the currency, for example 'USD'String
products.$.priceThe decimal money amount (price) for the productNumber
products.$.skuThe SKU (stock keeping unit) associated with the variantString
cart_idA globally unique identifier for the cartString
subtotalThe price at checkout before duties, shipping, and taxesNumber
currencyThe three-letter code that represents the currency, for example 'USD'String

Checkout and purchase Track event properties

checkout-and-purchase-track-event-properties page anchor

The properties below are included with Checkout Started, Address Info Entered, Shipping Info Entered, Contact Info Entered, Payment Info Entered and Order Completed Track events. products.$. indicates an array named 'products'.

(information)

Missing properties?

Your Segment events may be missing one of the following properties if Shopify provides null or an empty value for a property.

PropertyDescriptionType
products.$.product_idUnique ID for the productString
products.$.nameThe product nameString
products.$.untranslated_nameUntranslated name of the productString
products.$.variantThe product variantString
products.$.untranslated_variantUntranslated product variantString
products.$.categoryProduct type specified by the merchantString
products.$.brandThe product's vendor nameString
products.$.urlURL to the product pageString
products.$.image_urlURL to the product imageString
products.$.currencyThe three-letter code that represents the currency, for example 'USD'String
products.$.priceThe decimal money amount (price) for the productNumber
products.$.skuThe SKU (stock keeping unit) associated with the variantString
subtotalThe price at checkout before duties, shipping, and taxesNumber
currencyThe three-letter code that represents the currency, for example 'USD'String
order_idThe ID for the orderString
checkout_idA unique identifier for a particular checkoutString
shippingTotal shipping priceNumber
discountTotal monetary value allocated as a discountNumber
couponComma delimited list of customer-facing discount names / codesString
payment_methodComma delimited list of payment providers used for the transactionString

Sending user profile details to Segment

sending-user-profile-details-to-segment page anchor

User profile details can be sent to Segment in 3 ways:

  1. As traits in Identify events.
  2. As properties in Track events.
  3. As traits in Track events, included in the context.traits object.

User profile details are only sent to Segment when the following track events are triggered by Shopify: Checkout Started, Address Info Entered, Shipping Info Entered, Contact Info Entered, Payment Info Entered and Order Completed.

You can control how user profile details are sent to Segment on the 'Manage user profile details' section of the Shopify App User Interface.

Screenshot of the Manage user profile details settings section.

The following user profile details are sent to Segment as they become available in the user checkout journey.

User profile trait / property nameDescription
emailThe user's email address
phoneThe user's phone number address
first_nameThe user's first name
last_nameThe user's last name
billing_address.address1Billing address first line
billing_address.address2Billing address second line
billing_address.cityBilling address city
billing_address.countryBilling address country
billing_address.postal_codeBilling address post code / zip code
billing_address.province_codeBilling address province or state code
billing_address.countryBilling address country
shipping_address.address1Shipping address first line
shipping_address.address2Shipping address second line
shipping_address.cityShipping address city
shipping_address.countryShipping address country
shipping_address.postal_codeShipping address post code / zip code
shipping_address.province_codeShipping address province or state code
shipping_address.countryShipping address country

Why don't I see all of my events?

why-dont-i-see-all-of-my-events page anchor

This Source uses client-side Javascript to send data to Segment. As with any client-side analytics tracking, some ad-blockers prevent data from being sent to Segment. This can lead to an under reporting of events to Segment. For more information about data loss associated with ad blockers, see the Ad Blocking documentation.

When do Identify events trigger?

when-do-identify-events-trigger page anchor

To send Identify events, you must select the 'Send identify() calls' checkbox. If this setting is selected, Identify events are triggered when Checkout Started, Address Info Entered, Shipping Info Entered, Contact Info Entered, Payment Info Entered or Order Completed Track calls are triggered.

Why aren't my Identify events triggering when expected?

why-arent-my-identify-events-triggering-when-expected page anchor

To save on API call volume, Segment only triggers an Identify event when user profile details have changed. If no change is detected, then the Identify call is not triggered.

Why are some events duplicated and triggered multiple times?

why-are-some-events-duplicated-and-triggered-multiple-times page anchor

Shopify sometimes erroneously triggers duplicate Address Info Entered, Shipping Info Entered, Contact Info Entered, Payment Info Entered events in short succession. This is a known bug with Shopify. Segment deduplicates the majority of these duplicate events but is unable to filter all of them out.

Why do some Address/Shipping/Contact/Payment Info Entered events contain product arrays?

why-do-some-addressshippingcontactpayment-info-entered-events-contain-product-arrays page anchor

Shopify sometimes includes product array details in Standard Events(link takes you to an external page) which Segment uses to populate the Address Info Entered, Shipping Info Entered, Contact Info Entered, Payment Info Entered events. Segment includes these product details in Segment events.

Why are some event properties missing even though the documentation indicates that they should be present?

why-are-some-event-properties-missing-even-though-the-documentation-indicates-that-they-should-be-present page anchor

Mapping code is in place to map the majority of valuable fields from Shopify's Standard Events(link takes you to an external page) to Segment events. If properties are missing, it is due to the values not being provided by the Shopify event.