Skip to main content

How to use Customer metafields as userID for Segment

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 created the customer metafield definition, go to the Littledata dashboard, click on the Segment connection settings , and open the Tracking Customisation tab. Here you’ll find the User ID setting:

note

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

Select Customer metafield. After you choose this option, an input field will appear where you can enter the namespace and key from your Customer metafield definition:

See where to define the Customer metafield

After you save the setting, all server-side events sent by Littledata will include the userId property using the value from your Shopify customer metafield.

Validate Customer metafield change

Segment raw event including the new Customer metafield definition

Troubleshooting

To use this feature, make sure the Customer metafield is created and defined in Shopify, then enter the same namespace and key in the Littledata app.

If the metafield is not created in Shopify but you enable it in Littledata, the userId will still be sent - but only on server-side events - and will fall back to the Shopify customer ID.

To link the metafield to your customers, you must add a value for that metafield on each customer profile you want associated with the identifier. For example:

Customer profile linked to metafield