How to use Customer metafields as userID for Segment

Updated on 2023-11-23

Why use customer metafields?

Customer metafields can be used by companies that have custom non-Shopify identifier for their customers, for example a Single Sign-On (SSO) system that unifies the customer identifiers across multiple apps or sites.

After you’ve setup the definition, you will need to go in the Littledata app > Data pipeline settings > Segment user ID for customers 

note:

When you select this setting, no userId will be sent on the client-side events, as we can’t access the Customer metafields from the web page.

Here you will need to select: Customer metafield. After you select this option, an input box will appear to paste in the namespace and key from the Customer metafield definition.

See where to define the Customer metafield

Find in the Littledata app the Customer metafield userID

After you save the setting, your server-side events will have the userId property set as the Shopify customer metafield value.

Validate Customer metafield change

Segment raw event including the new Customer metafield definition

Troubleshooting

In order for this feature to work, you will need to correctly create and define the Customer metafield in Shopify and after that paste it in the Littledata app.

If, for some reason, you do not have the metafield created in Shopify but you have it in the Littledata app, NO userId will be sent on both client-side and server-side.

In order for the metafield to be linked to your customers, you will need to manually add the metafield to every customer profile you want to be linked to that metafield. As shown below:

Customer profile linked to metafield