Can't do GA tracking across domains when using a form

  • 20 November 2015
  • 1 reply
  • 1 view

Hi,
I’m trying to track a clients traffic from e.g. sub.a.com/page1/?id=x to www.b.com/page2?id=x.
So I have added the allowlinker codes on both sides, which should normally add the _ga=y to my destination as www.b.com/page2?id=x&_ga=y.
But it’s not working through forms. Have you come across this before and can you please help me in any direction?
I have also tried to follow this recommendation, but with no luck. I even adjusted the code to identify the form to this:
var myForm = $(‘input[name=“pageVariant”]’).closest(“form”);            addListener(myForm, ‘submit’, decorateForm);
        
            function decorateForm(event) {
              event = event || window.event; // Cross browser hoops.
              var target = event.target || event.srcElement;
            
              if (target && target.action) {
                ga(‘linker:decorate’, target);
              }
            }
        
            // Cross browser way to listen for events.
            function addListener(element, type, callback) {
              if (element.addEventListener) element.addEventListener(type, callback);
              else if (element.attachEvent) element.attachEvent(‘on’ + type, callback);
            }
Best regards
Lars


1 reply

Hi there! I’m going to have my Support team dive into this one to see if there’s any insight we can provide, so keep your eyes peeled for an email shortly. Hang tight! We’ll be in touch shortly to (hopefully) sort this all out. :) 

Reply