I have a web form that does not call an action, but when submitted gets sent to a Javascript function, which in essence, pushes the information to a 3rd party booking engine, and I want to pass the cookies along. Basically the form gets sent to:
<a href="javascript:sendToCBE();"><img src="#"></a>
The sendToCBE function is as follows:
function sendToCBE(){
if (validateForm()){
setHidden();
document.forms[0].target="_blank";
document.forms[0].action="http://partners.kcdataservices.com/resort/custom/buildMyOwn.jsp";
document.forms[0].submit();
Is it possible to change this to
function sendToCBE(){
if (validateForm()){
setHidden();
document.forms[0].target="_blank";
document.forms[0].action="pageTracker._getLinkerUrl(http://partners.kcdataservices.com/resort/custom/buildMyOwn.jsp)";
document.forms[0].submit();
In order to have cross domain tracking and pass along the cookies so new ones are not set by the 3rd party booking engine? Is there a better (or simpler) way to do this that I have not found yet?
You may try this snippet. Make sure to put GA related code inside a try catch so if it’s not setup on the site the form still works.