Cross-domain linking with form post method doesn't work

970 views
Skip to first unread message

Elvinas Karalis

unread,
Sep 1, 2015, 4:57:29 AM9/1/15
to google-analytics-analyticsjs
Hello,
we have an e-shop with 3rd party shopping cart integrated.
We'd like to keep original referral for conversion that happens on 3rd party cart domain.

GA code in e-shop:

        <script type='text/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','//www.google-analytics.com/analytics.js','ga');
        ga('create', 'UA-33333-1', 'auto', {'allowLinker': true});
        ga('require', 'linker');
        ga('linker:autoLink', ['3rdPartyCart.com'],false, true );
        ga('send', 'pageview');
        </script>

GA code in 3rd party:

    <script type="text/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','//www.google-analytics.com/analytics.js','ga');
        ga('create', 'UA-33333-1', 'auto', {'allowLinker': true});
        ga('require', 'linker');
        ga('linker:autoLink', ['e-shop.com'], false, true );
        ga('send', 'pageview');
    </script>

Both cart and e-shop added to Referral Exclusion List in GA.

When visitor ads item to a cart and wants to buy it he / she must click "checkout" button, which is a form with submit method and it leads to 3rd party cart with SSL.
We followed those guidelines: https://developers.google.com/analytics/devguides/collection/analyticsjs/cross-domain#autoforms , but it didn't work.
Simple link in text leading to cart works just fine and generates ?_ga=1.99283479872.98324798274 querystring, but form does not.

Any help would be appreciated, we really need to have this working...

Franclin Foping

unread,
Sep 28, 2015, 12:49:04 PM9/28/15
to google-analytics-analyticsjs
Hi,

 I had a similar issue and even opened a thread about it on this forum and never got a response (https://groups.google.com/forum/?fromgroups=#!topic/google-analytics-analyticsjs/6BjVktSkBZ8).

 Eventually, I decided to do something about and went ahead with a manual decoration.

 The way it works is by overloading the hitCallback which is fired when the pageview event is triggered. All you need to do is to grab the tracking ID and decorate the links you want with it. It is maybe not perfect and it is better than nothing.

 The problem with auto decoration is that there is quite a lot of automation going on behind the scenes and without access to the code, it is difficult to debug the issue and find out what is happening. One of odd things is that the links and forms can only be decorated automatically if they are visible when the tracking code runs (remember this happens in the header of the page and the DOM may not yet be ready at this point).

 I can share some pseudocode with you if you want me to.

 Hope this helps.

Elvinas Karalis

unread,
Sep 28, 2015, 12:59:35 PM9/28/15
to google-analytics-analyticsjs
Hi, thanks for the reply.
We solved it with manual link decorations too. Which is something not right, because it required additional programming and resulted in higher then expected costs :(  I don't own the code, so can't tell you literally how it works, but basically it grabs clientId from cookie and changes post target to something like formdestination.com?_ga=1.182119591.1441315536.1362115890410
We also tried to implement it with a help of Google Tag Manager, but it didn't work as well. 

Franclin Foping

unread,
Sep 29, 2015, 4:38:44 AM9/29/15
to google-analytics-analyticsjs
Hi,

 At least we agreed that manual decorations seems to be the only way forward in this situation.
 One of the problems with this approach is that according to Google, the value of the tracker changes every couple of minutes so we can find ourselves decorating links with an obsolete tracker ID or client ID.
 How did you solve that problem or if you even consider it?
 You don't need to tell me the code but since the website you were dealing appears to be an ecommerce site, you can just tell me the website itself and I will have a look myself.

 Thanks,
 Franclin
Reply all
Reply to author
Forward
0 new messages