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.