Stitching Visitor ID and User ID


I am tracking people landing on our commercial website thanks to the visitor ID.
At one point, some of them can decide to signup for our service.

They go then to our app website which is on another domain.
The visitor ID is passed thanks to pk_vid in the URL.

On the app domain, they can finally fill in the signup form.
Once done, they enter the app.

Inside the app, we have a policy to never add external script and it is the same for the Piwik script.
Still, I would like to stitch some events happening in our app via the HTTP API.

If the backend events are sent using the HTTP API with the visitor ID (passed to the backend) and a new USER ID only known from the app backend, will Piwik be able to stitch the events tracked on the commercial website with a visitor ID only with the events from the back-end events sent via HTTP API with a visitor ID AND a Uuser ID?

thank you.

Yes, it should work. It’s a pretty similar scenario to the standard one:

  • one browses site anonymously with visitor id set from the cookie
  • there’s is a login event, user id is set
  • in this case, the existing session is updated and enriched with the user id value
  • during the next requests you don’t have to provide visitor id, user id is enough

The problem is that it is directly sent from the backend to http api.

The cookie won’t be updated.

Will that work?

It’ll work as long as the first call from other system contains also matching visitor id (_id).

1 Like