Migrate client side tracking and server side tracking data within 30 minutes as same visit

I had launch an experiment and event based goal conversion as success metric.

The experiment was implement in client side and the goal conversion event was sent by server side.

I found that even it was record by same user id and all actions done by same user within 30 minutes,
it still created a new visit in database.

The experiment data was record in data from client side tracking, and event tracking by service created another visit record.

Is it possible to migrate the action from client/server side tracking into same visit?

How can I integrate the experiment in client side and use the server side tracking event as the success metric of experiment?

Maybe if youuse the same userID it could be possible.
If not, Matomo won’t be able to associate all in the same visit.
Why isn’t the client side that send the goal event?

Yes I use same user id in both client and server side tracking.

That is a goal for tracking user done the payment, so I have to wait for payment server callback to ensure the user has paid.

I presume that after payment, the user see a payment confirmation page. Why doesn’t this page send the goal event?

Can you provide the HTTP requests sent by page view (before payment) and the HTTP request made by you server?

Thanks for you reply.

I presume that after payment, the user see a payment confirmation page. Why doesn’t this page send the goal event?

The payment confirmation page just meant that user had created order successfully, because some payment method have to pay by offline (ATM machine / convenience store etc.), payment service will callback the result to our back-end server once the user made payment.

Can you provide the HTTP requests sent by page view (before payment) and the HTTP request made by you server?

The requests as below:

Client:
“POST /matomo.php?action_name=[page title]&idsite=2&rec=1&r=251716&h=9&m=32&s=48&url=[url]&urlref=[url ref]&uid=[user id]&_id=[visitor id]&_idn=0&_refts=0&send_image=0&pdf=1&qt=0&realp=0&wma=0&fla=0&java=0&ag=0&cookie=1&res=1536x864&pv_id=aZGPei HTTP/1.1”

Server:
“POST /matomo.php?idsite=2&rec=1&action_name=OrderCompleted&uid=[user id]&e_c=E nhancedEcommerce&e_a=OrderCompleted HTTP/1.1”

I replaced the sensitive info by [value], but the uid of client request same as server request.

Reading the documentation, I see:
https://developer.matomo.org/api-reference/tracking-api#recommended-parameters

_id (recommended) — The unique visitor ID, must be a 16 characters hexadecimal string. Every unique visitor must be assigned a different ID and this ID must not change after it is assigned.

Also there:

If a User ID is set, either via setUserId in your favorite SDK or via &uid= in the Tracking API, then we will look first for visits where the log_visit.idvisitor matches the Visitor ID (as found in first party tracking cookies). If no visit is matched, we look for visits where either the log_visit.user_id matches the User ID, or where log_visit.config_id matches the visitor config_id.

Try either to use the same _id in the OrderCompleted tracking, or try to remove the _id from previous trackings…