3

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.

dartacus
  • 654
  • 1
  • 5
  • 16
  • Forgot to say: the Measurement Protocol does allow me to feed in campaign IDs, referrers and similar data, so if anyone knows how to extract that from the current google analytics session, that would also fix this. – dartacus Aug 20 '20 at 10:34

2 Answers2

1

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.

Michele Pisani
  • 13,567
  • 3
  • 25
  • 42
  • Thank you. Would you mind awfully clarifying what the 'campaign parameters' refer to? If it's utm_campaign, source, medium etc, then I won't know that server side and I'm back to somehow extracting them from the google analytics session client side pre-purchase and storing them in a server side session for use by the measurement protocol hit post-purchase, and I do not know how to get at these. – dartacus Aug 21 '20 at 12:43
  • 1
    Yes, I refer to utm_source, utm_medium, utm_campaign but also normal source and medium. – Michele Pisani Aug 21 '20 at 15:56
1

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/.

tcrepalde
  • 335
  • 1
  • 3
  • 10
  • Thanks for your response. The hit is sent literally milliseconds after the purchase event, immediately after 3DSecure redirection back to my site or other similar success response from a payment provider. I haven't solved this yet - I have seen some improvements in attribution since I last tweaked it to include more data, but there's still an awful lot of '(direct)'. There is a fair amount of delay but that's fine, I don't need real time data, just to be able to support decision making with stats. I'll try the qt param and have a look at the article, thank you. – dartacus Oct 14 '20 at 12:14