简体   繁体   中英

getLinkerUrl not passing cookies across domains - Google Analytics

I have a client who is using a form that links to a booking engine on a different domain. However, they aren't using a traditionally coded form so to speak:

<div id="qs" align="center">
  <div align="center"><img src="images/qs_title.gif" alt="Quick Search">
      <table width="200" border="0" cellpadding="0" cellspacing="0">
        <!--<form  method="post">--><form  method="post">

....

 <td width="35%" valign="bottom"><div align="left"><a href="javascript:sendToCBE();"><img src="quicksearch/continue-buttom_dreams.gif" alt="Continue" width="83" height="24" border="0" ></a></div></td>

Because the form is being managed by the JavaScript Document CBE, that was modified with a getLinkerURL code:

// JavaScript Document
function popup_no_status(loc)
{
var windowW=1000
var windowH=700
s = "width="+windowW+",height="+windowH+",status=yes, resizable=yes, scrollbars=yes";
mywin = window.open(pageTracker._getLinkerUrl(loc), "CBE", s);
mywin.focus();
}

I've been told that this should work, but it doesn't seem to be passing the cookies along. The target/domain page does have the pageTracker._setAllowLinker(true); code on it. However, only the target page has the setAllowHash(false); code on it. Does Domain 1 (the domain I want to pass the cookies) need that setAllowHash(false); code as well? I'm not sure what I'm missing here. The cookies aren't being passed along and so I'm getting a referral cookie from the first domain. Any ideas? All insight is much appreciated!

I'm new to stackoverflow and I don't have sufficient reputation comment on the question to clarify it so apologies if I'm breaking any etiquette rules as this is more of an attempt to help than an actual answer.

  1. Does the new popup window's url have the additional tracking parameters appended to it? The cookies are created based on these parameters so if this is not happening that's what you need to fix.

  2. If they are present, then it's probably an issue with your GA setup on the second domain.

If they're not present, add:

console.log('loc: ' + loc');

after: mywin = window.open(pageTracker._getLinkerUrl(loc), "CBE", s);

The url which is logged should have the tracking parameters appended. If not then your issue is with the first domain.

  1. If the parameters are in the loc url, then you should see what's happening after that point - perhaps you have a redirect or something stripping the parameters.

BTW, I've done cross-domain tracking with the deprecated _setAllowHash present and it hasn't caused a problem so I doubt this is an issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM