Browser security rules make tracking goals on cross domains a little tricky for every client-side application, and some custom integration is necessary.
The only goal type that can be measured on cross domains is the Custom Goal.
Necessary steps
Let’s say you have two different domains – domain-one.com and domain-two.com, and you want to set an experiment on domain-one.com which sends the visitors to domain-two.com, and you want to track how many of them convert on domain-two.com.
In order to do that, on the domain-two.com page, on which you want to track conversions (for example, domain-two.com/thank-you.html), you must insert an iframe in the body of the thank you page, that contains a link to a custom page (conversion.html) hosted on the original domain/website which in this case is domain-one.com.
The iframe script that must be inserted is the following:
<iframe src="http://domain-one.com/conversion.html">
The conversion.html page is a stand-alone HTML page, hosted on the domain-one.com that should contain the following code:
<html>
<head>
<!-- start omniconvert.com code -->
<link rel="dns-prefetch" href="//app.omniconvert.com">
<script>
var _mktz = _mktz || [];
_mktz.push(['_Goal','sale','VALUE',{transaction:'REPLACE_WITH_YOUR_ID'}]);
//insert the goal code generated by Omniconvert and the transaction ID
</script>
<script type="text/javascript" src="//cdn.omniconvert.com/js/YOURID.js"></script>
<!-- end omniconvert.com code -->
</head>
<body>
</body>
</html>If you need to save a goal value you can pass it via a GET parameter to this iframe. In this case, the URL should look like this: http://domain-one.com/conversion.html?sale=[value]
Also, the iframe code has to be modified to handle the new parameter:
<script>
var urlParams = new URLSearchParams(window.location.search);
var saleValue = urlParams.get(“sale”);
var _mktz = _mktz || [];
_mktz.push(['_Goal','sale','saleValue',{transaction:'REPLACE_WITH_YOUR_ID'}]);
//insert the goal code generated by Omniconvert
</script>Attention: This code must be installed only on the page where you want to track the goal – Example: the thank you page – NOT on the pages where the experiments are running. Installing it on the pages where experiments are active will stop them from working!