Google Analytics cookie across SagePay checkout
- by AlexCambridgeUK
We use SagePay's Server integration for our online payments. We use Google Analytics to track activity on our website and Google Ecommerce tracking to log transactions.
In Google Analytics, under the Ecommerce view, it shows direct/none for source/medium, as the 1st party cookie is lost when visiting the external SagePay checkout pages before the customer is redirected to my confirmation page which tracks the transaction.
In all the answers I have viewed when searching for a solution, the suggestion is to alter the tracking code to read
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
but this needs to be implemented on all pages, including 3rd party domains (SagePay). As SagePay don't allow javascript in their template customisation, what can I do? Is there another way?
Edit:
I just found this code:
var pageTracker = _gat._getTracker('UA-XXXXX-X');
pageTracker._setCampNameKey('ga_campaign'); // name
pageTracker._setCampMediumKey('ga_medium'); // medium
pageTracker._setCampSourceKey('ga_source'); // source
pageTracker._setCampNOKey('ga_nooverride'); // don't override
pageTracker._trackPageview();
Could I store pre-checkout values for source/campaign/medium to a cookie and the retrieve it post-checkout into the code above, or would this start a new tracking session?