@analytics/mixpanel
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -6,2 +6,15 @@ # Change Log | ||
# [0.4.0](https://github.com/DavidWells/analytics/compare/@analytics/mixpanel@0.3.1...@analytics/mixpanel@0.4.0) (2021-09-25) | ||
### Features | ||
* allow mixpanel options to be specified ([a444328](https://github.com/DavidWells/analytics/commit/a444328)) | ||
* enrich mixpanel page events by send all provided properties ([b2ab2bb](https://github.com/DavidWells/analytics/commit/b2ab2bb)) | ||
* support setting of mixpanel page event names ([f7e2fd7](https://github.com/DavidWells/analytics/commit/f7e2fd7)) | ||
## [0.3.1](https://github.com/DavidWells/analytics/compare/@analytics/mixpanel@0.3.0...@analytics/mixpanel@0.3.1) (2020-12-23) | ||
@@ -8,0 +21,0 @@ |
var analyticsMixpanel = (function () { | ||
'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(source, true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(source).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
function mixpanelPlugin$1() { | ||
@@ -14,3 +63,5 @@ var pluginConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var token = config.token, | ||
customScriptSrc = config.customScriptSrc; | ||
customScriptSrc = config.customScriptSrc, | ||
_config$options = config.options, | ||
options = _config$options === void 0 ? {} : _config$options; | ||
@@ -111,5 +162,5 @@ if (!token) { | ||
mixpanel.init(config.token, { | ||
mixpanel.init(config.token, _objectSpread2({ | ||
batch_requests: true | ||
}); | ||
}, options)); | ||
}, | ||
@@ -144,5 +195,3 @@ | ||
var payload = _ref3.payload; | ||
mixpanel.track(payload.properties.path, { | ||
search: payload.properties.search | ||
}); | ||
mixpanel.track(pluginConfig.pageEvent || payload.properties.path, payload.properties); | ||
}, | ||
@@ -149,0 +198,0 @@ |
@@ -1,1 +0,1 @@ | ||
var analyticsMixpanel=function(){"use strict";return function(){return{name:"mixpanel",config:arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},initialize:function(e){var t=e.config,n=t.token,i=t.customScriptSrc;if(!n)throw new Error("No mixpanel token defined");void 0===window.mixpanel&&(function(e,t){if(!t.__SV){var n,a,o=window;try{var r,p,c,l=o.location,s=l.hash;r=function(e,t){return(p=e.match(RegExp(t+"=([^&]*)")))?p[1]:null},s&&r(s,"state")&&"mpeditor"===(c=JSON.parse(decodeURIComponent(r(s,"state")))).action&&(o.sessionStorage.setItem("_mpcehash",s),history.replaceState(c.desiredHash||"",e.title,l.pathname+l.search))}catch(e){}window.mixpanel=t,t._i=[],t.init=function(e,i,o){function r(e,t){var n=t.split(".");2==n.length&&(e=e[n[0]],t=n[1]),e[t]=function(){e.push([t].concat(Array.prototype.slice.call(arguments,0)))}}var p=t;for(void 0!==o?p=t[o]=[]:o="mixpanel",p.people=p.people||[],p.toString=function(e){var t="mixpanel";return"mixpanel"!==o&&(t+="."+o),e||(t+=" (stub)"),t},p.people.toString=function(){return p.toString(1)+".people (stub)"},n="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 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(" "),a=0;a<n.length;a++)r(p,n[a]);var c="set set_once union unset remove delete".split(" ");p.get_group=function(){function e(e){t[e]=function(){call2_args=arguments,call2=[e].concat(Array.prototype.slice.call(call2_args,0)),p.push([n,call2])}}for(var t={},n=["get_group"].concat(Array.prototype.slice.call(arguments,0)),i=0;i<c.length;i++)e(c[i]);return t},t._i.push([e,i,o])},t.__SV=1.2,(o=e.createElement("script")).type="text/javascript",o.async=!0,o.src=i||("undefined"!=typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.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"),(r=e.getElementsByTagName("script")[0]).parentNode.insertBefore(o,r)}}(document,window.mixpanel||[]),mixpanel.init(t.token,{batch_requests:!0}))},identify:function(e){var t=e.payload,n=t.userId,i=t.traits;"string"==typeof n&&mixpanel.identify(n),i&&mixpanel.people.set(i)},page:function(e){var t=e.payload;mixpanel.track(t.properties.path,{search:t.properties.search})},track:function(e){var t=e.payload;mixpanel.track(t.event,t.properties)},loaded:function(){return!!window.mixpanel},reset:function(){mixpanel.reset()},methods:{alias:function(e,t){mixpanel.alias(e,t)}}}}}(); | ||
var analyticsMixpanel=function(){"use strict";function e(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}return function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{name:"mixpanel",config:n,initialize:function(n){var r=n.config,i=r.token,o=r.customScriptSrc,a=r.options,p=void 0===a?{}:a;if(!i)throw new Error("No mixpanel token defined");void 0===window.mixpanel&&(function(e,t){if(!t.__SV){var n,r,i=window;try{var a,p,c,l=i.location,s=l.hash;a=function(e,t){return(p=e.match(RegExp(t+"=([^&]*)")))?p[1]:null},s&&a(s,"state")&&"mpeditor"===(c=JSON.parse(decodeURIComponent(a(s,"state")))).action&&(i.sessionStorage.setItem("_mpcehash",s),history.replaceState(c.desiredHash||"",e.title,l.pathname+l.search))}catch(e){}window.mixpanel=t,t._i=[],t.init=function(e,i,o){function a(e,t){var n=t.split(".");2==n.length&&(e=e[n[0]],t=n[1]),e[t]=function(){e.push([t].concat(Array.prototype.slice.call(arguments,0)))}}var p=t;for(void 0!==o?p=t[o]=[]:o="mixpanel",p.people=p.people||[],p.toString=function(e){var t="mixpanel";return"mixpanel"!==o&&(t+="."+o),e||(t+=" (stub)"),t},p.people.toString=function(){return p.toString(1)+".people (stub)"},n="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 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(" "),r=0;r<n.length;r++)a(p,n[r]);var c="set set_once union unset remove delete".split(" ");p.get_group=function(){function e(e){t[e]=function(){call2_args=arguments,call2=[e].concat(Array.prototype.slice.call(call2_args,0)),p.push([n,call2])}}for(var t={},n=["get_group"].concat(Array.prototype.slice.call(arguments,0)),r=0;r<c.length;r++)e(c[r]);return t},t._i.push([e,i,o])},t.__SV=1.2,(i=e.createElement("script")).type="text/javascript",i.async=!0,i.src=o||("undefined"!=typeof MIXPANEL_CUSTOM_LIB_URL?MIXPANEL_CUSTOM_LIB_URL:"file:"===e.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"),(a=e.getElementsByTagName("script")[0]).parentNode.insertBefore(i,a)}}(document,window.mixpanel||[]),mixpanel.init(r.token,function(n){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?t(i,!0).forEach(function(t){e(n,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(i)):t(i).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(i,e))})}return n}({batch_requests:!0},p)))},identify:function(e){var t=e.payload,n=t.userId,r=t.traits;"string"==typeof n&&mixpanel.identify(n),r&&mixpanel.people.set(r)},page:function(e){var t=e.payload;mixpanel.track(n.pageEvent||t.properties.path,t.properties)},track:function(e){var t=e.payload;mixpanel.track(t.event,t.properties)},loaded:function(){return!!window.mixpanel},reset:function(){mixpanel.reset()},methods:{alias:function(e,t){mixpanel.alias(e,t)}}}}}(); |
'use strict'; | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(source, true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(source).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
function mixpanelPlugin$1() { | ||
@@ -13,3 +62,5 @@ var pluginConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var token = config.token, | ||
customScriptSrc = config.customScriptSrc; | ||
customScriptSrc = config.customScriptSrc, | ||
_config$options = config.options, | ||
options = _config$options === void 0 ? {} : _config$options; | ||
@@ -110,5 +161,5 @@ if (!token) { | ||
mixpanel.init(config.token, { | ||
mixpanel.init(config.token, _objectSpread2({ | ||
batch_requests: true | ||
}); | ||
}, options)); | ||
}, | ||
@@ -143,5 +194,3 @@ | ||
var payload = _ref3.payload; | ||
mixpanel.track(payload.properties.path, { | ||
search: payload.properties.search | ||
}); | ||
mixpanel.track(pluginConfig.pageEvent || payload.properties.path, payload.properties); | ||
}, | ||
@@ -148,0 +197,0 @@ |
@@ -0,1 +1,50 @@ | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(source, true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(source).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
function mixpanelPlugin$1() { | ||
@@ -11,3 +60,5 @@ var pluginConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var token = config.token, | ||
customScriptSrc = config.customScriptSrc; | ||
customScriptSrc = config.customScriptSrc, | ||
_config$options = config.options, | ||
options = _config$options === void 0 ? {} : _config$options; | ||
@@ -108,5 +159,5 @@ if (!token) { | ||
mixpanel.init(config.token, { | ||
mixpanel.init(config.token, _objectSpread2({ | ||
batch_requests: true | ||
}); | ||
}, options)); | ||
}, | ||
@@ -141,5 +192,3 @@ | ||
var payload = _ref3.payload; | ||
mixpanel.track(payload.properties.path, { | ||
search: payload.properties.search | ||
}); | ||
mixpanel.track(pluginConfig.pageEvent || payload.properties.path, payload.properties); | ||
}, | ||
@@ -146,0 +195,0 @@ |
{ | ||
"name": "@analytics/mixpanel", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "Mixpanel plugin for 'analytics' module", | ||
@@ -54,3 +54,3 @@ "projectMeta": { | ||
}, | ||
"gitHead": "8da3f086a80377e6f5593028426f25ef323bcaac" | ||
"gitHead": "8d9abaf9e3e37aaaeccdeae3556b6aa50196474b" | ||
} |
@@ -21,4 +21,4 @@ <!-- | ||
- [Browser usage](#browser-usage) | ||
* [Browser API](#browser-api) | ||
* [Configuration options for browser](#configuration-options-for-browser) | ||
- [Browser API](#browser-api) | ||
- [Configuration options for browser](#configuration-options-for-browser) | ||
- [Additional examples](#additional-examples) | ||
@@ -115,2 +115,3 @@ | ||
| `token` <br/>**required** - string| The mixpanel token associated to a mixpanel project | | ||
| `pageEvent` <br/>_optional_ - string| Event name to use for page() events (default to page path) | | ||
| `customScriptSrc` <br/>_optional_ - string| Load mixpanel script from custom source | | ||
@@ -117,0 +118,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42242
724
227