How can I glue together two episodes into the one GA4 session starting from add_to_cart and ending with purchase to track as one user journey?

Stages now:

  1. Visitor is on the website with GTM(+GA4) where adds an item to the cart and proceeds to the checkout. I can see both add_to_cart and begin_checkout events in the tag assistant console and GA4 debug view.

  2. Fetch client_id and session_id with gtag function and combine a success link for the acquiring system to return the visitor/customer to our website when payment is completed.

gtag('get', 'G-xxxxxxxxxx', 'session_id', (session_id) => window.ga4_sid = session_id);
gtag('get', 'G-xxxxxxxxxx', 'client_id', (client_id) => window.ga4_cid = client_id);
  1. Redirect to the 3rd party webpage where visitor makes a payment.

  2. Visitor is back within URL combined at the second stage which consists two parameters session_id and client_id.

window.ga4_sid = url_parameters.get('ga4_sid');
window.ga4_cid = url_parameters.get('ga4_cid');

4a) Restore GA4 session and continue original flow.

gtag('config', 'G-xxxxxxxxxx', {'client_id': window.ga4_cid, 'session_id': window.ga4_sid});

4b) Push purchase event to the data layer. I can see the event just in the tag assistant flow but not in the GA4 debug view

Why GA4 does not recognise this purchase as the final event of the same journey?


Your Answer

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