analytics.ejs 6.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <script type="text/javascript">
  2. (function(f,b){if(!b.__SV){var e,g,i,h;window.mixpanel=b;b._i=[];b.init=function(e,f,c){function g(a,d){var b=d.split(".");2==b.length&&(a=a[b[0]],d=b[1]);a[d]=function(){a.push([d].concat(Array.prototype.slice.call(arguments,0)))}}var a=b;"undefined"!==typeof c?a=b[c]=[]:c="mixpanel";a.people=a.people||[];a.toString=function(a){var d="mixpanel";"mixpanel"!==c&&(d+="."+c);a||(d+=" (stub)");return d};a.people.toString=function(){return a.toString(1)+".people (stub)"};i="disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking start_batch_senders people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove".split(" ");
  3. for(h=0;h<i.length;h++)g(a,i[h]);var j="set set_once union unset remove delete".split(" ");a.get_group=function(){function b(c){d[c]=function(){call2_args=arguments;call2=[c].concat(Array.prototype.slice.call(call2_args,0));a.push([e,call2])}}for(var d={},e=["get_group"].concat(Array.prototype.slice.call(arguments,0)),c=0;c<j.length;c++)b(j[c]);return d};b._i.push([e,f,c])};b.__SV=1.2;e=f.createElement("script");e.type="text/javascript";e.async=!0;e.src="undefined"!==typeof MIXPANEL_CUSTOM_LIB_URL?
  4. MIXPANEL_CUSTOM_LIB_URL:"file:"===f.location.protocol&&"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js".match(/^\/\//)?"https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js":"//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js";g=f.getElementsByTagName("script")[0];g.parentNode.insertBefore(e,g)}})(document,window.mixpanel||[]);
  5. mixpanel.init("<%- config.mixpanel_token %>", {api_host: "https://api.mixpanel.com"});
  6. mixpanel.set_config({
  7. // HTTP method for tracking requests
  8. api_method: 'POST',
  9. // transport for sending requests ('XHR' or 'sendBeacon')
  10. // NB: sendBeacon should only be used for scenarios such as
  11. // page unload where a &quot;best-effort&quot; attempt to send is
  12. // acceptable; the sendBeacon API does not support callbacks
  13. // or any way to know the result of the request. Mixpanel
  14. // tracking via sendBeacon will not support any event-
  15. // batching or retry mechanisms.
  16. api_transport: 'XHR',
  17. // turn on request-batching/queueing/retry
  18. batch_requests: false,
  19. // maximum number of events/updates to send in a single
  20. // network request
  21. batch_size: 50,
  22. // milliseconds to wait between sending batch requests
  23. batch_flush_interval_ms: 5000,
  24. // milliseconds to wait for network responses to batch requests
  25. // before they are considered timed-out and retried
  26. batch_request_timeout_ms: 90000,
  27. // override value for cookie domain, only useful for ensuring
  28. // correct cross-subdomain cookies on unusual domains like
  29. // subdomain.mainsite.avocat.fr; NB this cannot be used to
  30. // set cookies on a different domain than the current origin
  31. cookie_domain: '',
  32. // super properties cookie expiration (in days)
  33. cookie_expiration: 365,
  34. // if true, cookie will be set with SameSite=None; Secure
  35. // this is only useful in special situations, like embedded
  36. // 3rd-party iframes that set up a Mixpanel instance
  37. cross_site_cookie: false,
  38. // super properties span subdomains
  39. cross_subdomain_cookie: true,
  40. // debug mode
  41. debug: true,
  42. // if this is true, the mixpanel cookie or localStorage entry
  43. // will be deleted, and no user persistence will take place
  44. disable_persistence: false,
  45. // if this is true, Mixpanel will automatically determine
  46. // City, Region and Country data using the IP address of
  47. //the client
  48. ip: true,
  49. // opt users out of tracking by this Mixpanel instance by default
  50. opt_out_tracking_by_default: false,
  51. // opt users out of browser data storage by this Mixpanel instance by default
  52. opt_out_persistence_by_default: false,
  53. // persistence mechanism used by opt-in/opt-out methods - cookie
  54. // or localStorage - falls back to cookie if localStorage is unavailable
  55. opt_out_tracking_persistence_type: 'localStorage',
  56. // customize the name of cookie/localStorage set by opt-in/opt-out methods
  57. opt_out_tracking_cookie_prefix: null,
  58. // type of persistent store for super properties (cookie/
  59. // localStorage) if set to 'localStorage', any existing
  60. // mixpanel cookie value with the same persistence_name
  61. // will be transferred to localStorage and deleted
  62. persistence: 'cookie',
  63. // name for super properties persistent store
  64. persistence_name: '',
  65. // names of properties/superproperties which should never
  66. // be sent with track() calls
  67. property_blacklist: [],
  68. // if this is true, mixpanel cookies will be marked as
  69. // secure, meaning they will only be transmitted over https
  70. secure_cookie: false,
  71. // the amount of time track_links will
  72. // wait for Mixpanel's servers to respond
  73. track_links_timeout: 300,
  74. // if you set upgrade to be true, the library will check for
  75. // a cookie from our old js library and import super
  76. // properties from it, then the old cookie is deleted
  77. // The upgrade config option only works in the initialization,
  78. // so make sure you set it when you create the library.
  79. upgrade: true,
  80. // extra HTTP request headers to set for each API request, in
  81. // the format {'Header-Name': value}
  82. xhr_headers: {},
  83. // protocol for fetching in-app message resources, e.g.
  84. // 'https://' or 'http://'; defaults to '//' (which defers to the
  85. // current page's protocol)
  86. inapp_protocol: '//',
  87. // whether to open in-app message link in new tab/window
  88. inapp_link_new_window: false,
  89. // whether to ignore or respect the web browser's Do Not Track setting
  90. ignore_dnt: true
  91. });
  92. </script>