Cross-domain tracking

Warning:The cross-domain tracking method describes in this article applies only to transitions from page A to page B using the tag.

Cross-domain tracking means that there are two or more different domains in a site, and links to different domains are measured as the same session.

For example, if you want to filter out users who go from a.com to b.com and convert on b.com, you need to set up cross-domain tracking to filter the numerical data and heatmaps on a.com.

Note:
Transitions between subdomains do not fall under the category of cross-domain, so you do not need to change anything if there is a transition from www.test.com to sp.test.com. The session will continue on Ptengine automatically.

Normal cross-domain setting #

If you want to track anything happened on different domain, you will need to do cross-domain tracking.

  • 1You will need to implement a special tag only for page A. The special tag is the following part.

    _pt_sp_2.push('setCrossDomainLink,allManual');

    ※ As a minimum, you will need to implement the API in (A) above, but you can include tags implemented in B and C as well.

    <script type="text/javascript">
            if(!window._pt_sp_2){
                window._pt_lt = new Date().getTime();
                window._pt_sp_2 = [];
                _pt_sp_2.push('setAccount,********');
        _pt_sp_2.push('setCrossDomainLink,allManual');
                var _protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
                (function() {
                    var atag = document.createElement('script'); atag.type = 'text/javascript'; atag.async = true;
                    atag.src = _protocol + 'js.ptengine.jp/********.js';
                    var s = document.getElementsByTagName('script')[0];
                    s.parentNode.insertBefore(atag, s);
                })();
            }
    </script> 

    Warning:The parts in red need to be unified.

  • 2Only on page A in the diagram above, add "onclick="pt_domain"" to the link going to B.
    (例)<a href>="https://b.com/contact.html" onclick=“pt_domain”>Demo Request</a>.
    However, for <form>, even if you add onclick="pt_domain", you will not be able to connect cross-domain sessions. In this case, you will not be able to filter the numerical data and heatmap of a.com for users who converted on b.com as explained in the beginning of this article.

  • 3 Put measurement tags on all pages that visitors pass through from the time they enter the site to the time they reach the CV. If you do not have Ptengine measurement tags on all the pages that visitors pass through before they reach the CV, you will not be able to perform cross-domain CV measurement.

Cross-domain setting of all external links #

  • 1As with normal cross-domain settings, you will need to implement a special tag only for the A page.
    In this case, the special tag is the following code.

    _pt_sp_2.push('setCrossDomainLink,halfManual');

    halfManual is a semi-manual mode. Once you add the above code to your website, the cross-domain processing will be executed for all buttons on the corresponding web page without any other modification.

    <script type="text/javascript"<script type="text/javascript">
            if(!window._pt_sp_2){
                window._pt_lt = new Date().getTime();
                window._pt_sp_2 = [];
                _pt_sp_2.push('setAccount,********');
        _pt_sp_2.push('setCrossDomainLink,halfManual');
                var _protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
                (function() {
                    var atag = document.createElement('script'); atag.type = 'text/javascript'; atag.async = true;
                    atag.src = _protocol + 'js.ptengine.jp/********.js';
                    var s = document.getElementsByTagName('script')[0];
                    s.parentNode.insertBefore(atag, s);
                })();
            }
    </script>

    Warning:The parts in red need to be unified.

  • 2You can put measurement tags on all the pages that visitors pass through from the time they enter the site to the time they reach the CV. This allows for cross-domain measurement.

Was this article helpful?

  • Yes, great!
  • Not really

Thanks for your feedback.

  Sorry about that. Do you mind sharing how we can improve?

    Write your feedback here...