Shopify standard integration setup
This page walks you through how to integrate Braze with Shopify using our standard integration for users with a Shopify online store. If you use a Shopify headless site or are looking to implement more tailored solutions, refer to Shopify custom integration setup.
Step 1: Connect your Shopify store
- In Braze, go to Partner Integrations > Technology Partners and then search for “Shopify”.
If you’re using the older navigation, you can find Technology Partners under Integrations.
- On the Shopify partner page, select Begin setup to start the integration process.
- In the Shopify app store, install the Braze application.
If your Shopify account is associated with more than one store, you can change the store you’re logged into by selecting the store icon at the top-right of the page and selecting Switch stores.
- After installing the Braze app, you’ll be redirected to Braze to confirm the workspace you want to connect to Shopify. A Shopify store can connect to only one workspace. If you need to switch, select the correct workspace.
- Select Begin setup.
Step 2: Enable Braze Web SDKs
For Shopify online stores, you can select the standard setup to automatically implement the Braze Web SDK and JavaScript SDK.
After you select the standard setup onboarding path, you’ll need to choose when Braze should initialize and load the SDKs from one of the following options:
- Upon site visit, such as session start
- Tracks both identified and anonymous users
- Upon account signup, such as account login
- Track only identified users
- Starts tracking data when site visitors sign up or log into their accounts
Step 3: Configure your Shopify data
Standard data setup
Now you’ll select the Shopify data you want to track.
The following events will be enabled by default in the standard integration.
Braze recommended events | Shopify custom events | Shopify custom attributes |
---|---|---|
|
|
|
For more information on the data tracked through the integration, refer to Shopify Data Features.
Historical backfill setup
Through the standard setup, you have the option to perform an initial load of your Shopify customers and orders from the last 90 days prior to your Shopify integration connection. To do so, select the checkbox to include the initial data load as part of your integration.
This table contains the data that will be initially loaded through the backfill.
Braze recommended events | Shopify custom events | Braze standard attributes | Braze subscription statuses |
---|---|---|---|
|
|
|
|
As your Shopify customer records are loaded into Braze, the Shopify customer ID will be used as the Braze external ID.
If you’re an existing Braze customer with active campaigns or Canvases, review Shopify data features for more details.
(Advanced) Custom data tracking setup
With the Braze SDKs, you can track custom events or custom attributes that go beyond standard events for this integration. Custom events capture unique interactions in your store, such as:
Custom events | Custom attributes |
---|---|
|
|
Tracking custom data helps you gain deeper insights into user behavior and personalize their experience even further. To implement custom events, you need to edit your storefront’s theme code in the theme.liquid
file. You may need help from your developers.
For example, the following JavaScript snippet tracks if the current user subscribes to a newsletter, and logs that as a custom event on their profile in Braze:
1
2
3
4
5
6
7
8
9
braze.logCustomEvent(
“subscribed_to_newsletter”,
{
newsletterName: ‘News and Offers’,
customerEmail: ‘customer_1@gmail.com’,
sendOffers: true
}
);
The SDK must be initialized (listening for activity) on a user’s device to log events or custom attributes. To learn more about logging custom data, refer to User object and logCustomEvent object.
Step 4: Configure how you manage users
Select your external_id
type from the dropdown.
Using an email address or a hashed email address as your Braze external ID can help simplify identity management across your data sources. However, it’s important to consider the potential risks to user privacy and data security.
- Guessable Information: Email addresses are easily guessable, making them vulnerable to attacks.
- Risk of Exploitation: If a malicious user alters their web browser to send someone else’s email address as their external ID, they could potentially access sensitive messages or account information.
By default, Braze automatically converts emails from Shopify to lowercase before using them as the external ID. If you’re using email or hashed email as your external ID, confirm that your email addresses are also converted to lowercase before you assign them as your external ID or before hashing them from other data sources. This helps prevent discrepancies in external IDs and avoid creating duplicate user profiles in Braze.
If you selected a custom external ID type, proceed to steps 4.1—4.3. Otherwise, continue to step 4.4.
Step 4.1: Create the braze.external_id
metafield
- In your Shopify admin panel, go to Settings > Metafields.
- Select Customers > Add definition.
- For Namespace and key, enter
braze.external_id
. - For Type, select ID Type.
After the metafield is created, populate it for your customers. We recommend the following approaches:
- Listen to customer creation webhooks: Set up a webhook to listen for
customer/create
events. This allows you to write the metafield when a new customer is created. - Backfill existing customers: Use the Admin API or Customer API to backfill the metafield for previously created customers.
Step 4.2: Create an endpoint to retrieve your external ID
You need to create a public endpoint that Braze can call to retrieve the external ID. This is necessary for scenarios where Shopify can’t provide the braze.external_id
metafield.
Endpoint specifications
Method: GET
Parameters | Description |
---|---|
shopify_customer_id |
The Shopify customer ID. |
email_address |
The email address of the logged-in user. |
shopify_storefront |
The storefront for the request. |
Example endpoint
1
2
GET
https://mystore.com/custom_id?shopify_customer_id=1234&[email protected]&shopify_storefront=dev-store.myshopify.com
Expected response
Braze expects a 200
status code. Any other code is considered a failure.
1
2
3
{
"external_id": "my_external_id"
}
It’s important to validate that the shopify_customer_id
and email_address
match the customer values in Shopify. You can use the Admin API or Customer API to validate these parameters and retrieve the braze.external_id
metafield.
Step 4.3: Input your external ID
Repeat Step 4, and enter your endpoint URL after selecting custom external ID as your Braze external ID type.
Considerations
- If your external ID isn’t generated when Braze sends a request to your endpoint, the integration will default to using the Shopify customer ID when the
changeUser
function is called. This step is crucial for merging the anonymous user profile with the identified user profile. As a result, there may be a temporary period during which different types of external IDs exist within your workspace. - When the external ID is available in the
braze.external_id
metafield, the integration will prioritize and assign this external ID.- If the Shopify customer ID was previously set as the Braze external ID, it will be replaced with the
braze.external_id
metafield value.
- If the Shopify customer ID was previously set as the Braze external ID, it will be replaced with the
Step 4.4: Collect your email or SMS opt-ins from Shopify (optional)
You have the option to collect your email or SMS marketing opt-ins from Shopify.
If you use the email or SMS channels, you can sync your email and SMS marketing opt-in states into Braze. If you sync email marketing opt-ins from Shopify, Braze will automatically create an email subscription group for all users associated with that specific store. You need to create a unique name for this subscription group.
As mentioned in Shopify overview, if you want to use a third-party capture form, your developers need to integrate Braze SDK code. This will let you capture the email address and global email subscription status from form submissions. Specifically, you need to implement and test these methods to your theme.liquid
file:
- setEmail: Sets the email address on the user profile
- setEmailNotificationSubscriptionType: Updates the global email subscription status
Step 5: Sync products (optional)
You can sync all products from your Shopify store to a Braze catalog for deeper messaging personalization. Automatic updates occur in near real-time so your catalog always reflects the latest product details. To learn more, check out Shopify product sync.
Step 6: Activate Channels (optional)
You can enable in-app messages without using a developer by configuring them in your setup.
Braze collects visitor information, such as email addresses and phone numbers, through in-browser messages. This information is then sent to Shopify. This data helps merchants recognize visitors to their store and create a more personalized shopping experience. For more details, refer to Visitor API.
Supporting additional SDK channels
The Braze SDKs enable various messaging channels, including Content Cards.
Content Cards and Feature Flags
To add content cards or feature flags, you will need to collaborate with your developers to insert the necessary SDK code directly into your theme.liquid
file. For detailed instructions, refer to Integrating the Braze SDK.
Web push notifications
Web push currently isn’t supported for the Shopify integration. If you want to see this supported in the future, submit a product request through the Braze product portal.
If you wish to see this supported in the future, submit a product request through the Braze product portal.
Step 7: Finish setup
- After you configure your setup, select Finish Setup.
- Enable the Braze app embed within your Shopify theme settings. Select Open Shopify to be redirected to your Shopify account to enable the app embed within your store’s theme settings.
- After you enable the app embed, your setup is complete!
Confirm you can view your integration settings, the status of initial data sync, and your active Shopify events.