Shopify CDP Connector Usage
Step-by-step guide for installing and configuring the CDP Connector to integrate Segment's customer data platform with your Shopify store for comprehensive event tracking.
Installing CDP Connector
Log in to your Shopify Store as an admin and install Attribution CDP Connector for Segment from the Shopify App Store.
Once you complete the onboarding steps, CDP Connector will automatically install the Segment snippet on your store and begin collecting data.
Understanding How CDP Connector Works
CDP Connector consists of multiple modules working at different levels. While each module operates independently, all modules are required to ensure the most accurate data collection.
- ScriptTag - Installs the Segment snippet on your Shopify storefront and updates the cart to include
anonymous_id. Since the Segment snippet is included, it will also load your destination Device-mode integrations. - Web Pixel - Translates and sends native Shopify Standard events to Segment, including form submissions and custom events. For a full list of events, see the "Shopify Web Pixel Events" section of Shopify CDP Connector Events Spec. Can optionally fire
page()calls if configured to run without ScriptTag (see "Settings" section below). - Webhook - Captures Shopify webhooks and translates them into Segment "Order" events. For a full list, see "Webhook Events" in the Shopify CDP Connector Events Spec.
- UI Extension - (Optional) Updates the Shopify cart with
anonymous_idwhen ScriptTag is disabled.
Connecting Attribution in Segment
You can connect Attribution as a destination in Segment. While this step is optional, it helps us validate correct data collection and identify any issues you might encounter. If Attribution is not connected in Segment, we will not be able to see your data since CDP Connector is a standalone application that works as a pass-through and doesn't store any data.
Identity Resolution and "anonymous_id"
CDP Connector resolves customer identity from their first visit through to purchase. The identify() call may fire multiple times along the visitor journey—on login, during checkout, and from webhook events. If a Shopify Customer ID is available, it will be used as the user_id. We attempt to keep anonymous_id consistent across the entire visitor journey, however this isn't always possible due to multiple factors such as ad blockers, customer network connection issues, and others.
By default, the Shopify cart is updated to include analytics_anonymous_id, which later becomes available on the Order object in Shopify webhook. CDP Connector then fires Order events with anonymous_id included, though this isn't always the case. The user_id is set by default (resolving to the Shopify customer ID) on all Order events. You may often see Order events without anonymous_id but with user_id. In these cases, you'll need to search for pageviews with the same user_id from the identify() call to find matching visitors.
This follows the recommended Segment approach: first try to resolve identity using user_id, then fall back to anonymous_id.
Consent Management
CDP Connector has native support for Shopify's Customer Privacy API and can translate its events into Segment Consent Management events and spec. If you use a third-party consent management system and want to integrate it with CDP Connector, you need to configure your consent management system to properly set data processing in Shopify's Customer Privacy API, and CDP Connector will work with it automatically.
By default, consent management is disabled. See the "Settings" section below for configuration options.
Shopify Headless Stores
If you're running a headless store, the only CDP Connector component that will work is "Webhook" (see above). This means you'll need to install Segment manually in your store. Additionally, your Order events will not have anonymous_id unless you set analytics_anonymous_id on cart.attributes in Shopify. If you use a combination of Shopify Storefront and a headless store, you can use the source_name property of Order events to identify where the order originated.
Manually Installing Segment Snippet
If you want to install and manage the Segment snippet manually while still capturing "Web Pixel" and "Webhook" events, you can do so by enabling "Send Pageviews from Web Pixel" in the settings. We strongly recommend also enabling "UI Extension" as it allows proper anonymous_id synchronization between your manual Segment installation and CDP Connector.
UI Extension
This is a small Shopify theme extension that updates the cart to set anonymous_id. This allows CDP Connector to maintain consistent visitor identity across the entire customer journey, required when ScriptTag is disabled or when using a manual Segment installation. Significantly improves data collection accuracy.
Settings
CDP Connector provides extensive configuration options to customize data collection and event tracking behavior. Access CDP Connector settings through the Shopify admin panel after installing the app.
Core Configuration
User ID Source
Determines which Shopify customer property is used as the user_id in tracking events:
- shopify_customer_id (default) - Uses internal Shopify customer ID
- email - Uses customer's email address
- none - Doesn't set
user_id, relies only onanonymous_id
Order Completed Trigger Topic
Determines which webhook triggers the "Order Completed" event:
orders/paid(default) - Fires when payment is receivedorders/fulfilled- Fires when the order is fulfilled
Web Pixel Configuration
Web Pixel
Enables Shopify Web Pixel to fire additional ecommerce events from the storefront, capturing customer interactions in real-time.
Send Pageviews from Web Pixel
Disables ScriptTag and sends pageview events through Web Pixel instead. This disables automatic Segment snippet installation, and as a result, all events are sent using Cloud-mode.
Track Form Submitted
Enabled by default. Captures Shopify's form_submitted DOM events, useful for newsletter signups and custom forms. Implementation depends on your store's theme.
Track Custom Events
Enabled by default. Captures custom events sent via Shopify.analytics.publish() and forwards them to Attribution or Segment.
Send Raw Shopify Event Data
When enabled, attaches the original Shopify event data as shopify_event_data property on all Web Pixel events. Useful for debugging or accessing additional Shopify-specific properties.
Privacy & Consent
Customer Privacy Mode
Controls how CDP Connector handles Shopify's Customer Privacy API:
- disabled (default) - Doesn't send
context.consentor honor Shopify Customer Privacy settings. All events are sent regardless of customer consent preferences. - pass_through (recommended) - Attaches
context.consentto all events as set in Shopify's Customer Privacy API, but still sends all events regardless of user consent preferences. This allows you to later decide in Segment how to enable the data. - strict - Fully honors Shopify Customer Privacy settings. Blocks and queues all events until customer consent is obtained. Only sends events for customers who have opted in. Attaches
context.consentto all allowed events.
See the "Consent Management" section above for more details on integration with consent management platforms.
Advanced Settings
Additional Order Properties
Specify additional Shopify order fields to include in Order webhook events as properties.
Debug Mode
Enables verbose logging for troubleshooting and attaches additional properties to events.
Updated 2 days ago
