// 设置统计id var url = window.location.href.split('?')[0] if (url.indexOf('haibaobaoxian') !== -1) { // haibaobaoxian initPiwik() } function initPiwik() { if (url.indexOf('mall') !== -1 || url.indexOf('goodsList') !== -1) { window._hb_piwik_id = '9' } else if (url.indexOf('app') !== -1) { window._hb_piwik_id = '13' }else { window._hb_piwik_id = '4' } var _paq = _paq || [] window._paq = _paq _paq.push(['setCampaignNameKey', 'pcode']) _paq.push(['setDomains', ['*.haibaobaoxian.com']]) // _paq.push(['trackPageView']) _paq.push(['enableLinkTracking']) var u = '//news.haibaobaoxian.com/piwik/' _paq.push(['setTrackerUrl', u + 'piwik.php']) _paq.push(['setSiteId', window._hb_piwik_id]) var d = document var g = d.createElement('script') var s = d.getElementsByTagName('script')[0] g.type = 'text/javascript' g.async = true g.defer = true g.src = u + 'piwik.js' s.parentNode.insertBefore(g, s) }