search

Home  >  Q&A  >  body text

angular.js - angularjs 百度统计怎么统计

貌似只能统计到根目录啊

PHPzPHPz2745 days ago654

reply all(3)I'll reply

  • 为情所困

    为情所困2017-05-15 17:04:59

    Mark and come back later


    For details, please see https://tongji.baidu.com/open...
    Baidu Statistics has a corresponding API interface.
    Then I encapsulated it

    var BaiduTongJi = {
        visitPage : function ()
        {
            _hmt.push(['_trackPageview', _path]);
        }
    };
    

    Then add a locationChangeStart event listener in your angular, similar to my code below.

            app.run(function($rootScope, $location){
                $rootScope.$on('$locationChangeStart', function ()
                {
                    BaiduTongJi.visitPage($location.path());
                })
            });

    reply
    0
  • PHP中文网

    PHP中文网2017-05-15 17:04:59

    How to solve it?

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-15 17:04:59

    Looking for answers together. I know the main question, please let me know

    reply
    0
  • Cancelreply