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

The QR Code url looks like this: https://www.zoles.eu/wp-login.php?user_id=8839&token=...&magic-login=1&redirect_to=https://www.zoles.eu/zola-b2c/

So as u can see there is already a userid in it. Buy how do i extract this userid when the session is on the phone

You need to use that user id and store the cookies you need for that user in Stape Store/Firebase.

Then set up the logic that when the url has the user_id parameter - take this value, go to Stape Store/Firebase, find the cookies of this user and if there are any set them for example via CookieMonster tag.
There could be other options - but this seems the easiest to me.

So the the user_id generated in the QR code link, needs to get passed on to the URL that it redirects you too? which in this case is www.zoles.eu/zola-b2c

I am already storeing cookies in Firebase

Do i understand taht correcty?

Yes, that’s correct and based on that user id you can take the cookie from Firestore and set it for the user on the new domain.