To track calls across domains no changes are required to be made to Delacon’s standard tracking code to enable cross domain tracking. However, the links between the domain’s need to be altered.
Where the link on the first domain to the second domain would normally be;
<a href=”http://otherdomain.com/entry.html”>Jump to another domain</a>
This should be changed to:
<a href=”http://otherdomain.com/entry.html” onclick=”_ctlink(“http://otherdomain.com/entry.html”, true); return false”>Jump to another domain</a>
Google Analytics
Delacon’s cross domain tracking works in conjunction with Google Analytics tracking code (if it is being used), but additional variables need to be set to allow this. Where the standard GA code would be:
<script type=”text/javascript”>
var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXXX-X’]);
_gaq.push([‘_trackPageview’]);
(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();
Two additional _gaq.push variables need to be added as below:
<script type=”text/javascript”>
var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXXX-X’]);
_gaq.push([‘_setDomainName’, ‘.xyz.com’]);
_gaq.push([‘_setAllowLinker’, true]);
_gaq.push([‘_trackPageview’]);
_setDomainName needs to be set to the domain of the current page and should not be set to “none”
The links between the domains need to be altered as well, to as follows;
<a href=”http://otherdomain.com/entry.html” onClick=”_gaq.push(‘_link’, _ctlink(‘http://otherdomain.com/entry.html’));return false;”>Jump to another domain</a>
Please note that:
If the _setDomainName in Google Analytics is required to be “none” for any reason, a small alteration of Delacon’s tracking code needs to be made to allow this.
Where the standards Delacon code has;
var dd = document, ll = dd.createElement(“script”), ss = dd.getElementsByTagName(“script”)[0];
ll.type = “text/javascript”; ll.async = true; ll.src = (“https:” == document.location.protocol ? “https://” : “http://”) + “vxml4.delacon.com.au/sited/ref/phonenum.jsp?m_id=XXMIDXX&cids=”
+ cids + “&ref=” + refStr;
ss.parentNode.insertBefore(ll,ss);
The amended code should be:
var dd = document, ll = dd.createElement(“script”), ss = dd.getElementsByTagName(“script”)[0];
ll.type = “text/javascript”; ll.async = true; ll.src = (“https:” == document.location.protocol ? “https://” : “http://”) + “vxml4.delacon.com.au/sited/ref/phonenum.jsp?
dgat=0&m_id=XXMIDXX&cids=” + cids + “&ref=” + refStr;
ss.parentNode.insertBefore(ll,ss);
How do you track calls across sub-domains?
If we do not specifying anything, our tracking code will treat the website that it first landed as the domain. For example, if the landing page is www.example-tracking.com, then the domain that is tracked is www.example-tracking.com. If the user click an link to blog.example-tracking.com, we will regard them as two different domain and hence a new session is created which is not quite the customer wants.
We can certainly use the cross tracking feature to solve the problem but it is like using a canon to kill a fly.
We have just release the tracking code that if the domain is specified, we will regard that domain and its subdomain as one entity. For example if .example-tracking.com (remember the period in front) is specified, we will regard www.example-tracking.com and blog.example-tracking.com as one domain together with any subdomain from example-tracking.com. The line that are required to added is just something like
var trDomain=”.track-example.com”;
in the first line of Delacon standard tracking code.
So the resultant tracking code will be
<script type=”text/javascript”>
var trDomain=”.track-example.com”; // new additional line to specify the domain
var cids=”10000,10001″;
var refStr = escape(document.referrer);
document.write(unescape(“%3Cscript src='” + (‘https:’ == document.location.protocol ? ‘https://’ : ‘http://’) + “vxml4.delacon.com.au/sited/ref/phonenum.jsp?m_id=6&cids=” + cids + “&ref=” + refStr + “‘ type=’text/javascript’%3E%3C/script%3E”));