I need to have a userId passed into Shopify and have it save with the customer data

We have a task where we’re sending out links to our users that redirect them to shopfiy. When the users click on it and shop, they might buy the product and create an account with an email we don’t have. We want to figure out a way to pass in a tracking id and track the user in shopify. If they make a purchase and use a different email, we need to make sure we have this tracking id in the order, so we can tie this data back to the user.

So far, Shopify’s help is no help and couldn’t answer this question. Does anyone know how to do this? I can’t imagine we’re the first one doing this

This is somewhat difficult. Tracking is done with session id. You can in theory pass a custom id and save it to local storage for tracking purposes but it is quite difficult to get it working. Then you can perhaps pass such id to Google Analytics to replace session id.

Most likely you would not need such a setup. It is better to use standard tracking and a simpler workflow in my opinion.