How to use Customer metafields as userID for Segment

Updated on 2024-07-12

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 set the definition, you will need to go to the Littledata dashboardand and click on Segment connection. Under the Tracking Customisation tab you can find User ID setting.

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

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 you do not have the metafield created in Shopify but you have set it in Littledata app, userId will be sent only on server-side events as shopify customer id.

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