Cross device tracking

Hi, What be the best solution to cross device tracking?
I have a case where you scan a QR code and then a session starts on your phone.

Would pushing a userid into the datalayer work?

Yes, you can use the consinstant user id. Usually it works fine only if the user is authorised on your site and when authorised on another device the same user id will be used in tracking.

Any generated user id as far as I know will not work well as they are generated on generic data ip address, user agent etc. And as a result either there is a chance that different users will have the same user id (e.g. if you just use the ip address), or the user id will vary depending on the user’s device/network.

You create an account on the website, where you put in your email, first and lastname. Then you land on a landingpage where the QR code appears and you scan that with your phone and a new session starts on your phone.

What userid would you recommend to use? and do i have to also push the userid to the purchase event?

You can use any user id you generate, for example it can be a hash of ip address + user agent + timestamp.
You can pass this user id as a parameter to the url which is encrypted in your qr code and thus pass it between domains