开发者

Google Analytics: prevent sending page title

开发者 https://www.devze.com 2023-02-14 19:26 出处:网络
How can I prevent GA from tracking the pag开发者_StackOverflowe title? Setting _setDetectTitle to false still sends the page title in the request to GA server (utmdt). Due to privacy issues, I do not

How can I prevent GA from tracking the pag开发者_StackOverflowe title? Setting _setDetectTitle to false still sends the page title in the request to GA server (utmdt). Due to privacy issues, I do not want the page title to leave the browser. Any ideas?


_setDetectTitle is working just fine for me. You just need to call it before the _trackPageview call:

    var _gaq=_gaq||[];
    _gaq.push(['_setAccount','UA-XXXXXX-1']);
    _gaq.push(['_setDetectTitle', false]);    
    _gaq.push(['_trackPageview'])

You can contrast the __utm.gif hit sent in a version with _setDetectTitle set to false, versus sent in a standard version.

In the former, the utmdt isn't set, in the latter, it is.

Screenshots: The one on the left sends the page title; the one on the right doesn't.

Google Analytics: prevent sending page title

Google Analytics: prevent sending page title


It's working fine when I try it. Here's the code I'm using:

    <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
        _gaq.push(['_setDetectTitle', false]);
        _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);
        })();
    </script>
0

精彩评论

暂无评论...
验证码 换一张
取 消