Reputation: 644
How do I make sure that customer purchases tracked using the Measurement Protocol retain their association with the original Google Analytics session?
Detail:
When my site stopped registering customer purchases in Google Analytics (a whole other problem) I moved over to using the Measurement Protocol to send transactions to GA. This works *almost*
perfectly - purchases appear in Google Analytics (I'm using Enhanced Ecommerce tracking) reliably.
However, almost all transactions are attributed to the 'direct' channel. Only a very few - perhaps 10% - retain their association with the campaign or channel that brought the customer to my site.
Here is an example of what I send using the Measurement protocol, from the 'thank you' page after a customer has made an order.
Array
(
[v] => 1
[tid] => UA-1234567-1
[cid] => 424729672.1597913127
[t] => pageview
[dh] => www.mysitename.co.uk
[dp] => /complete.php
[dt] => complete
[ti] => 540892
[ta] => Company Name
[tr] => 162.50
[tt] => 32.50
[ts] => 0
[col] => UNKNOWN
[pa] => purchase
[ua] => Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36
[geoid] => GB
[uip] => 12.34.56.78
[cu] => GBP
[uid] => 798f77110ea1667e9fdfc27ce83471042f01884c
[pr1id] => 15154737723
[pr1nm] => Product name in product colour
[pr1br] => Brand name
[pr1ca] => Product Category name
[pr1pr] => 195.00
[pr1qt] => 1
[pr1va] => Brown & tan
[z] => 1640
)
As you can see cid
and uid
are present. The cid is extracted from the _ga cookie. The uid (added yesterday) is what I have previously assigned to the customer earlier in their checkout process, but adding this has not improved the attribution situation. (Should I wait 24-48 hours to check?)
All payment processors, including 3D Secure domains, have been added to my Referral Exclusions list. My site is split between www.mysitename.co.uk (browsing) and secure.mysitename.co.uk (buying), but both of these domains are in the exclusion list as well, so I don't think it's cross domain issues, although the symptoms are similar.
utm_nooverride=1
has been added to the 'success' URLs supplied to payment processors, also, to no avail.
The site runs on a LAMP stack, apache 2.4, php 5.6. Server upgrade is due soon.
There are no other issues with Google Analytics. As well as Universal Analytics there is also some Google Tag Manager usage on the site.
Upvotes: 3
Views: 684
Reputation: 435
I've noticed that you're not sending the queue time parameter (qt) in the request. Are you sending the hits immediately after the phone call? Does this action occur moments later?
I believe that even if you send the hit immediately after the phone call, Google Analytics could process the hit with some delay. The queue time parameter is important to specify the exact time of the action.
I'm sending Enhanced Ecommerce purchases through the measurement protocol as well and I send the queue time parameter with the difference in seconds between the real timestamp of the purchase and the timestamp of the moment that my hit is being sent.
If you already solved this question, let us know.
You can read about sending a hit to a moment in the past in this excellent article https://www.simoahava.com/analytics/send-hits-past-google-analytics/.
Upvotes: 1
Reputation: 14179
If two hits share the Google Analytics Property ID and the Client ID (cid), and they take place within the session timeout (30 minutes) and on the same side of midnight, and they share all the campaign parameters, then they will be contained in the same session.
Upvotes: 1