GA4 Server Side / GTM Combination

Hello dear Stape community,

I have a question about what you think is the best approach.

We operate a website where we offer desktop software for download. On this website, we use Stape with GTM as normal. Everything works great.

However, we now need to do a server-side redirect to our software. There are several reasons for this, but it is not possible to use GTM here. Nevertheless, we would like to track the redirect correctly and assign it to the right user.

A key event should be triggered for the server-side redirect. This should be assigned to the correct user who was previously on our website.

Now the question is how best to send the key event. Here we could use the “Measurement Protocol” and send a key event by mail. But now the question is: Where do we get the correct user ID from the user if they have already been on our website? If the user goes directly to the redirect, which user ID should we use?

Or does it make sense to use the Stape SDK instead? Perhaps in combination with the reStore tag?