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?


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?


1 Answer 1


One alternative option could solve your tracking issue and yield a smoother user experience: inFrame integration.

Sage Pay allow you to customise/skin their payment pages and load them within an iFrame on your own website. Customers never leave your own URL, so tracking carries on like normal. Plus, customers feel like they never leave your website whilst Sage Pay still handle all transactional functionality.

Sage Pay inFrame integration

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.