Cross domain tracking not working (Shopify Custom Storefront + Shopify checkout)

7 0 1

Good day Shopify community,

We have implemented shopify together with custom storefront (react based app), and somehow cross domain tracking is not working.
The session of one user is not continuous between page and shopify cart. When going to shopify cart new session starts and the source is shown as (direct), even if original session's source was "email".

We seem to have implemented Google Analytics tag & referral exclusion list correctly, but don't know why the sessions are split. Can someone help please? Is there something wrong?

For reference, here is the code I added in shopify>online store>preferences "Additional Google Analytics JavaScript":


(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//','ga');

ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', [''] );
ga('send', 'pageview');