Google Analytics - Multiple Trackers for Several Accounts?

后端 未结 5 1505
刺人心
刺人心 2021-02-02 13:02

Maybe I\'m going about this wrong, but I\'m hoping I can get some insight. I develop for multiple clients nationwide. I track many of my sites using my personal/development An

相关标签:
5条回答
  • 2021-02-02 13:14

    Now made easy with the new asynchronous tracking code. :)

    http://code.google.com/apis/analytics/docs/tracking/asyncUsageGuide.html#MultipleTrackers

    0 讨论(0)
  • 2021-02-02 13:20

    I think its common thing. Samething happens in the company I work for. We have GA and loads of other tags from marketing guys. We just have to live with it.

    Analytics is best used by Marketing guys.

    0 讨论(0)
  • 2021-02-02 13:22

    It's possible to have multiple trackers on one site, for example like this:

    <script type="text/javascript">
    var trackerA = _gat._getTracker("UA-XXXXXXX-X");
    trackerA._initData();
    trackerA._trackPageview();
    var trackerB = _gat._getTracker("UA-XXXXXXX-X");
    trackerB._initData();
    trackerB._trackPageview();
    </script>
    

    Another option is to link multiple Google accounts to a single Google Analytics account (using the User Manager -link in the GA account overview).

    0 讨论(0)
  • 2021-02-02 13:24

    This also works for calling multiple _trackPageview after the page is loaded (for additional recorded actions, for example, tracking when somebody downloads a PDF)

    <script type="text/javascript">
        var ua_codes = ['UA-XXXXX-1', 'UA-XXXXX-2', 'UA-XXXXX-3']
        var _gaq = _gaq || [];
        for(i in ua_codes) {
            _gaq.push(['_setAccount', ua_codes[i]]);
            _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>
    
    <a href="/some_document.pdf" onClick="record_click(this.href);">Read the pdf</a>
    
    <script type="text/javascript">
        function record_click(track_url) {
            for(i in ua_codes) {
                _gaq.push(['_setAccount', ua_codes[i]]);
                _gaq.push(['_trackPageview', track_url]);
            }
        }
    </script>
    
    0 讨论(0)
  • 2021-02-02 13:31

    From the asynchronous api documentation

    Pushing commands to multiple trackers also works.

    _gaq.push( ['_setAccount', 'UA-XXXXX-1'],
               ['_trackPageview'],
               ['b._setAccount', 'UA-XXXXX-2'],
               ['b._trackPageview']);
    
    0 讨论(0)
提交回复
热议问题