How to use a customer metafield as the Segment userId
How to use a Shopify customer metafield as the userId in server-side events Littledata sends to Segment.
You can tell Littledata to use a Shopify customer metafield as the userId in events sent to Segment. This page explains when that helps and how to set it up.
Why use a customer metafield?
A customer metafield is useful if you identify your customers with your own ID, not the Shopify customer ID. For example, you might use a single sign-on (SSO) system that gives each customer the same ID across several apps or sites.
How to set it up
Create the customer metafield definition in Shopify
In your Shopify admin, go to Settings > Custom data > Customers and add a metafield definition, for example a Single line text field. Note its namespace and key, shown as namespace.key.

Add a value for each customer
Open each customer profile you want to link, and enter their ID in the metafield.

Open your Segment settings
Open the Littledata app from your Shopify admin. Find your Segment destination, click the ⋯ menu on its card and choose Settings.
Open Tracking customisation
Open the Tracking customisation tab and find the User ID setting.
Choose Customer metafield
Select Customer metafield. In the field that appears, enter the namespace and key of your metafield definition, for example custom.littledata.
Save
Click Save.
What gets sent to Segment
After you save, server-side events sent by Littledata use the value of the customer's metafield as the userId. You can check this in your Segment source debugger:

Littledata reads the metafield value from Shopify and saves it for that customer. It then reuses the saved value for that customer's later events.
Troubleshooting
Related articles
Last updated
Was this helpful?