Attach UserId to previous visits/visitorId's using HTTP API

I would like to attached a newly created UserId to previous sessions with a specific visitorId. We create users on a separate server via an API request, and we would like to link it to a visit that occured prior to that. That visit would have a different visitorId to the one created by the Userid (the visitorId becomes a hashed version of Userid, as the doc says.)

So we want to know what users were doing prior to being created, by pressing a button (tracked via javascript API) which goes to a third party registration service. We pass the current visitorId through to them, which in turn sends it to our API to track an api registration event(tracked via the HTTP API). We would like to marry the two sides using the visitorId that was passed through on the website end.

Any possible way to do this? Like a call to attach a UserId to certain visitorId’s or even over write them? It seems possible since this works flawlessy in the javascript API when you set a userId in an existing session, it overwrites the previous visitorId to the new userId. Any method in the HTTP tracking api?

Many Thanks

1 Like