track.js 615 B

12345678910111213141516171819202122
  1. /**
  2. * @fileOverview track f2
  3. * @author sima.zhang1990@gmail.com
  4. */
  5. const Global = require('./global');
  6. const Util = require('./util/common');
  7. const SERVER_URL = 'https://kcart.alipay.com/web/bi.do';
  8. setTimeout(function() {
  9. if (Global.trackable && Util.isBrowser) { // Only works for H5 env
  10. const image = new Image();
  11. const newObj = {
  12. pg: document.URL,
  13. r: new Date().getTime(),
  14. f2: true,
  15. version: Global.version,
  16. page_type: 'syslog'
  17. };
  18. const d = encodeURIComponent(JSON.stringify([ newObj ]));
  19. image.src = `${SERVER_URL}?BIProfile=merge&d=${d}`;
  20. }
  21. }, 3000);