autotrack@2.2.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. ;(function (para) {
  2. var p = para.sdk_url,
  3. n = para.name,
  4. w = window,
  5. d = document,
  6. s = 'script',
  7. x = null,
  8. y = null
  9. if (typeof w['sensorsDataAnalytic201505'] !== 'undefined') {
  10. return false
  11. }
  12. w['sensorsDataAnalytic201505'] = n
  13. w[n] =
  14. w[n] ||
  15. function (a) {
  16. return function () {
  17. ;(w[n]._q = w[n]._q || []).push([a, arguments])
  18. }
  19. }
  20. var ifs = [
  21. 'track',
  22. 'quick',
  23. 'register',
  24. 'registerPage',
  25. 'registerOnce',
  26. 'trackSignup',
  27. 'trackAbtest',
  28. 'setProfile',
  29. 'setOnceProfile',
  30. 'appendProfile',
  31. 'incrementProfile',
  32. 'deleteProfile',
  33. 'unsetProfile',
  34. 'identify',
  35. 'login',
  36. 'logout',
  37. 'trackLink',
  38. 'clearAllRegister',
  39. 'getAppStatus'
  40. ]
  41. for (var i = 0; i < ifs.length; i++) {
  42. w[n][ifs[i]] = w[n].call(null, ifs[i])
  43. }
  44. if (!w[n]._t) {
  45. ;(x = d.createElement(s)), (y = d.getElementsByTagName(s)[0])
  46. x.async = 1
  47. x.src = 'assets/plugins/session-event/index.js' //引用的session-event插件路径
  48. x.setAttribute('charset', 'UTF-8')
  49. w[n].para = para
  50. y.parentNode.insertBefore(x, y)
  51. ;(x = d.createElement(s)), (y = d.getElementsByTagName(s)[0])
  52. x.async = 1
  53. x.src = 'assets/plugins/exposure/index.js' //引用的exposure插件路径
  54. x.setAttribute('charset', 'UTF-8')
  55. w[n].para = para
  56. y.parentNode.insertBefore(x, y)
  57. ;(x = d.createElement(s)), (y = d.getElementsByTagName(s)[0])
  58. x.async = 1
  59. x.src = p
  60. x.setAttribute('charset', 'UTF-8')
  61. w[n].para = para
  62. y.parentNode.insertBefore(x, y)
  63. }
  64. sensors.quick('isReady', function () {
  65. sensors.use('Exposure', {
  66. area_rate: 1,
  67. stay_duration: 2,
  68. repeated: false
  69. })
  70. sensors.use('PageLeave', { heartbeat_interval_time: 5 })
  71. sensors.use('PageLoad')
  72. sensors.use('SessionEvent')
  73. })
  74. //sensors.quick('autoTrackSinglePage')
  75. })({
  76. sdk_url: 'assets/plugins/sensorsdata.js',
  77. name: 'sensors',
  78. show_log: true,
  79. is_track_single_page: false,
  80. // send_type:'beacon',
  81. server_url: 'https://receiver.tracking.zcunsoft.com/api/gp?project=clklog&token=4a793ea028fc327f4f1763b7630e1438', //clklog_receiver 的接收服务地址
  82. heatmap: {
  83. clickmap: 'default',
  84. scroll_notice_map: 'default',
  85. collect_tags: {
  86. div: true,
  87. img: true
  88. }
  89. },
  90. preset_properties: { latest_referrer_host: true }
  91. })