Browse Source

Production mode vue.js and Mixpanel full config

James Peret 2 years ago
parent
commit
d268d0270d

+ 13 - 1
readme.md

@@ -119,4 +119,16 @@ hexo deploy
 
 - [ ] Thumbnail images for game screenshots
 
-- [ ] Banner image file sizes are too big
+- [ ] Banner image file sizes are too big
+
+- [ ] Use the referrer attribute in mixpanel link tracking
+
+
+
+### Referrer tracking in Mixpanel
+
+```javascript
+mixpanel.track_links("#nav a", "click nav link", {
+        "referrer": document.referrer
+    });
+```

+ 86 - 0
themes/kairoscope-theme/layout/_partial/analytics.ejs

@@ -3,4 +3,90 @@
         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?
         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||[]);
         mixpanel.init("<%- config.mixpanel_token %>", {api_host: "https://api.mixpanel.com"});
+        mixpanel.set_config({
+            // HTTP method for tracking requests
+            api_method: 'POST',
+            // transport for sending requests ('XHR' or 'sendBeacon')
+            // NB: sendBeacon should only be used for scenarios such as
+            // page unload where a &quot;best-effort&quot; attempt to send is
+            // acceptable; the sendBeacon API does not support callbacks
+            // or any way to know the result of the request. Mixpanel
+            // tracking via sendBeacon will not support any event-
+            // batching or retry mechanisms.
+            api_transport: 'XHR',
+            // turn on request-batching/queueing/retry
+            batch_requests: false,
+            // maximum number of events/updates to send in a single
+            // network request
+            batch_size: 50,
+            // milliseconds to wait between sending batch requests
+            batch_flush_interval_ms: 5000,
+            // milliseconds to wait for network responses to batch requests
+            // before they are considered timed-out and retried
+            batch_request_timeout_ms: 90000,
+            // override value for cookie domain, only useful for ensuring
+            // correct cross-subdomain cookies on unusual domains like
+            // subdomain.mainsite.avocat.fr; NB this cannot be used to
+            // set cookies on a different domain than the current origin
+            cookie_domain: '',
+            // super properties cookie expiration (in days)
+            cookie_expiration: 365,
+            // if true, cookie will be set with SameSite=None; Secure
+            // this is only useful in special situations, like embedded
+            // 3rd-party iframes that set up a Mixpanel instance
+            cross_site_cookie: false,
+            // super properties span subdomains
+            cross_subdomain_cookie: true,
+            // debug mode
+            debug: true,
+            // if this is true, the mixpanel cookie or localStorage entry
+            // will be deleted, and no user persistence will take place
+            disable_persistence: false,
+            // if this is true, Mixpanel will automatically determine
+            // City, Region and Country data using the IP address of
+            //the client
+            ip: true,
+            // opt users out of tracking by this Mixpanel instance by default
+            opt_out_tracking_by_default: false,
+            // opt users out of browser data storage by this Mixpanel instance by default
+            opt_out_persistence_by_default: false,
+            // persistence mechanism used by opt-in/opt-out methods - cookie
+            // or localStorage - falls back to cookie if localStorage is unavailable
+            opt_out_tracking_persistence_type: 'localStorage',
+            // customize the name of cookie/localStorage set by opt-in/opt-out methods
+            opt_out_tracking_cookie_prefix: null,
+            // type of persistent store for super properties (cookie/
+            // localStorage) if set to 'localStorage', any existing
+            // mixpanel cookie value with the same persistence_name
+            // will be transferred to localStorage and deleted
+            persistence: 'cookie',
+            // name for super properties persistent store
+            persistence_name: '',
+            // names of properties/superproperties which should never
+            // be sent with track() calls
+            property_blacklist: [],
+            // if this is true, mixpanel cookies will be marked as
+            // secure, meaning they will only be transmitted over https
+            secure_cookie: true,
+            // the amount of time track_links will
+            // wait for Mixpanel's servers to respond
+            track_links_timeout: 300,
+            // if you set upgrade to be true, the library will check for
+            // a cookie from our old js library and import super
+            // properties from it, then the old cookie is deleted
+            // The upgrade config option only works in the initialization,
+            // so make sure you set it when you create the library.
+            upgrade: true,
+            // extra HTTP request headers to set for each API request, in
+            // the format {'Header-Name': value}
+            xhr_headers: {},
+            // protocol for fetching in-app message resources, e.g.
+            // 'https://' or 'http://'; defaults to '//' (which defers to the
+            // current page's protocol)
+            inapp_protocol: '//',
+            // whether to open in-app message link in new tab/window
+            inapp_link_new_window: false,
+            // whether to ignore or respect the web browser's Do Not Track setting
+            ignore_dnt: true
+        });
 </script>

+ 1 - 1
themes/kairoscope-theme/layout/layout.ejs

@@ -7,7 +7,7 @@
       <%- body %>
     </div>
   </body>
-  <script src="/js/vue.js"></script>
+  <script src="/js/vue.min.js"></script>
   <script src="/js/bootstrap.bundle.js"></script>
   <%- partial('_partial/vue') %>
   <%- partial('_partial/tracker') %>

File diff suppressed because it is too large
+ 5 - 0
themes/kairoscope-theme/source/js/vue.min.js


Some files were not shown because too many files changed in this diff