diff --git a/index.js b/index.js index 790583b..fe434bd 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ /** - * Vue Mixpanel v1.0.3 + * Vue Mixpanel v1.0.4 * https://github.com/Loschcode/vue-mixpanel * * Copyright 2019, cmp-cc diff --git a/package.json b/package.json index ea450df..6466d16 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-mixpanel", - "version": "1.0.3", + "version": "1.0.4", "description": "A simple library to use mixpanel through VueJS", "main": "index.js", "license": "MIT", diff --git a/utils/snippet.js b/utils/snippet.js index fd2370a..a7bf25b 100644 --- a/utils/snippet.js +++ b/utils/snippet.js @@ -1,14 +1,15 @@ -(function (e, a) { +(function (c, a) { if (!a.__SV) { - var b = window; try { var c; var l; var i; var j = b.location; var g = j.hash; c = function (a, b) { return (l = a.match(RegExp(b + '=([^&]*)'))) ? l[1] : null }; g && c(g, 'state') && (i = JSON.parse(decodeURIComponent(c(g, 'state'))), i.action === 'mpeditor' && (b.sessionStorage.setItem('_mpcehash', g), history.replaceState(i.desiredHash || '', e.title, j.pathname + j.search))) } catch (m) { } var k, h; window.mixpanel = a; a._i = []; a.init = function (b, c, f) { - function e (b, a) { - var c = a.split('.'); c.length == 2 && (b = b[c[0]], a = c[1]); b[a] = function () { - b.push([a].concat(Array.prototype.slice.call(arguments, + var b = window; try { var d; var m; var j; var k = b.location; var f = k.hash; d = function (a, b) { return (m = a.match(RegExp(b + '=([^&]*)'))) ? m[1] : null }; f && d(f, 'state') && (j = JSON.parse(decodeURIComponent(d(f, 'state'))), j.action === 'mpeditor' && (b.sessionStorage.setItem('_mpcehash', f), history.replaceState(j.desiredHash || '', c.title, k.pathname + k.search))) } catch (n) { } var l, h; window.mixpanel = a; a._i = []; a.init = function (b, d, g) { + function c (b, i) { + var a = i.split('.'); a.length == 2 && (b = b[a[0]], i = a[1]); b[i] = function () { + b.push([i].concat(Array.prototype.slice.call(arguments, 0))) } - } var d = a; typeof f !== 'undefined' ? d = a[f] = [] : f = 'mixpanel'; d.people = d.people || []; d.toString = function (b) { var a = 'mixpanel'; f !== 'mixpanel' && (a += '.' + f); b || (a += ' (stub)'); return a }; d.people.toString = function () { return d.toString(1) + '.people (stub)' }; k = 'disable time_event track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config reset people.set people.set_once people.increment people.append people.union people.track_charge people.clear_charges people.delete_user'.split(' ') - for (h = 0; h < k.length; h++)e(d, k[h]); a._i.push([b, c, f]) - }; a.__SV = 1.2; b = e.createElement('script'); b.type = 'text/javascript'; b.setAttribute('defer', ''); b.src = typeof MIXPANEL_CUSTOM_LIB_URL !== 'undefined' ? MIXPANEL_CUSTOM_LIB_URL : e.location.protocol === 'file:' && '//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'; c = e.getElementsByTagName('script')[0]; c.parentNode.insertBefore(b, c) + } var e = a; typeof g !== 'undefined' ? e = a[g] = [] : g = 'mixpanel'; e.people = e.people || []; e.toString = function (b) { var a = 'mixpanel'; g !== 'mixpanel' && (a += '.' + g); b || (a += ' (stub)'); return a }; e.people.toString = function () { return e.toString(1) + '.people (stub)' }; l = '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(' ') + for (h = 0; h < l.length; h++)c(e, l[h]); var f = 'set set_once union unset remove delete'.split(' '); e.get_group = function () { function a (c) { b[c] = function () { call2_args = arguments; call2 = [c].concat(Array.prototype.slice.call(call2_args, 0)); e.push([d, call2]) } } for (var b = {}, d = ['get_group'].concat(Array.prototype.slice.call(arguments, 0)), c = 0; c < f.length; c++)a(f[c]); return b }; a._i.push([b, d, g]) + }; a.__SV = 1.2; b = c.createElement('script'); b.type = 'text/javascript'; b.async = !0; b.src = typeof MIXPANEL_CUSTOM_LIB_URL !== 'undefined' + ? MIXPANEL_CUSTOM_LIB_URL : c.location.protocol === 'file:' && '//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'; d = c.getElementsByTagName('script')[0]; d.parentNode.insertBefore(b, d) } })(document, window.mixpanel || []) diff --git a/yarn.lock b/yarn.lock index d125dc8..fb57ccd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,48 +2,3 @@ # yarn lockfile v1 -agent-base@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" - integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== - dependencies: - es6-promisify "^5.0.0" - -debug@^3.1.0: - version "3.2.6" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" - integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== - dependencies: - ms "^2.1.1" - -es6-promise@^4.0.3: - version "4.2.8" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" - integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== - -es6-promisify@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" - integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= - dependencies: - es6-promise "^4.0.3" - -https-proxy-agent@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-3.0.0.tgz#0106efa5d63d6d6f3ab87c999fa4877a3fd1ff97" - integrity sha512-y4jAxNEihqvBI5F3SaO2rtsjIOnnNA8sEbuiP+UhJZJHeM2NRm6c09ax2tgqme+SgUUvjao2fJXF4h3D6Cb2HQ== - dependencies: - agent-base "^4.3.0" - debug "^3.1.0" - -mixpanel@^0.10.3: - version "0.10.3" - resolved "https://registry.yarnpkg.com/mixpanel/-/mixpanel-0.10.3.tgz#2dff3bc0e17b57d6365547d315cbbf3ecfdb8a00" - integrity sha512-wIYr5o+1XSzJ80o3QED35K/yfPAKi5FigZXTSfcs4vltfeKbilIjNgwxdno7LrqzhjoSjmIyDWkI7D3lr7TwDw== - dependencies: - https-proxy-agent "3.0.0" - -ms@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==