Hi,
Thank you for your research on the matter. I think you're onto something here. I've been looking into this today.
session_id is not mentioned on the list of parameters of the "purchase" event in the GA documentation:
developers.google.com/analytics/devguide...ence/events#purchase
However, the page about sending events with the measurement protocol mentions it in passing:
developers.google.com/analytics/devguide...nts?client_type=gtag
In order for user activity to display in reports like Realtime, engagement_time_msec and session_id must be supplied as part of the params for an event.
However, it doesn't mention that it would affect the traffic source or anything.
Following this, I've stumbled on this page:
trackingchef.com/google-analytics/how-to...ent-protocol-events/
There, the author says that the session_id is necessary to connect the conversions with the user visits. So it might be what's missing indeed.
It also provides a payload example and a method to get the session_id with raw javascript.
Now, the code proposed there directly extract that from the cookies and requires the stream id. That's not ideal.
Searching further on this, I found this:
stackoverflow.com/questions/26915432/how...-by-google-analytics
Which provides the gtag code to get the session_id. That's actually the same mechanism the plugin already uses to get the client_id, which is another information the plugin has to provide when using the measurement protocol.
Now, this doesn't mean that it will fix the "traffic source" issue. I didn't see a mention of this so far. So I searched further and I found this:
stackoverflow.com/a/75500170
So here, passing the session_id indeed seems to be the solution to the missing source.
So, to make it short, I think that with this I can cook up something so that the session_id is provided by the plugin when using the measurement protocol to notify GA of the purchases. It's a shame that GA doesn't properly document this. We all waste so much time on this.
Anyways. With all that in mind, I've been working on adding this to the plugin and I just made a new release for it:
www.hikashop.com/marketplace/product/108...egration-google.html
Please try it and let me know how it goes.