You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by dr...@apache.org on 2018/09/21 10:05:44 UTC

[4/4] incubator-unomi git commit: UNOMI-189 : Added personalization callbacks

UNOMI-189 : Added personalization callbacks


Project: http://git-wip-us.apache.org/repos/asf/incubator-unomi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-unomi/commit/b4b0560b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-unomi/tree/b4b0560b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-unomi/diff/b4b0560b

Branch: refs/heads/master
Commit: b4b0560b4385ce742d701f343ac075b940ab838e
Parents: 030f871
Author: tdraier <dr...@apache.org>
Authored: Fri Sep 21 12:05:31 2018 +0200
Committer: tdraier <dr...@apache.org>
Committed: Fri Sep 21 12:05:38 2018 +0200

----------------------------------------------------------------------
 .../javascript/dist/unomi-tracker.js            |    54 +-
 .../javascript/dist/unomi-tracker.min.js        |     2 +-
 extensions/web-tracker/javascript/package.json  |     3 +-
 extensions/web-tracker/javascript/snippet.js    |     4 +-
 .../web-tracker/javascript/snippet.min.js       |     2 +-
 .../analytics.js-integration-apache-unomi.js    |    47 +-
 extensions/web-tracker/javascript/yarn.lock     |  1105 +-
 extensions/web-tracker/wab/pom.xml              |     8 +-
 .../web-tracker/wab/src/main/webapp/index.html  |    38 +-
 .../src/main/webapp/javascript/unomi-tracker.js | 12453 -----------------
 .../main/webapp/javascript/unomi-tracker.min.js |    28 -
 11 files changed, 124 insertions(+), 13620 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b4b0560b/extensions/web-tracker/javascript/dist/unomi-tracker.js
----------------------------------------------------------------------
diff --git a/extensions/web-tracker/javascript/dist/unomi-tracker.js b/extensions/web-tracker/javascript/dist/unomi-tracker.js
index ae4bf20..bb06948 100644
--- a/extensions/web-tracker/javascript/dist/unomi-tracker.js
+++ b/extensions/web-tracker/javascript/dist/unomi-tracker.js
@@ -11856,9 +11856,9 @@ module.exports = uuid;
 },{"./rng":94}],96:[function(require,module,exports){
 module.exports={
   "name": "unomi-analytics",
-  "version": "1.0.2",
+  "version": "1.0.3",
   "description": "The Apache Unomi analytics.js integration.",
-  "main": "src/index.js",
+  "main": "dist/unomi-tracker.js",
   "keywords": [
     "unomi",
     "analytics.js",
@@ -11868,7 +11868,7 @@ module.exports={
   "license": "Apache-2.0",
   "scripts": {
     "build": "yarn browserify && yarn replace && yarn minify",
-    "browserify": "browserify src/index.js -p [ browserify-header --file src/license.js ] -s unomiTracker  > dist/unomi-tracker.js",
+    "browserify": "browserify src/index.js -p [ browserify-header --file src/license.js ] -s unomiTracker -o dist/unomi-tracker.js",
     "replace": "replace-in-file 'analytics.require = require' '//analytics.require = require' dist/unomi-tracker.js",
     "minify": "uglifyjs -c -m --comments '/@license/' -o dist/unomi-tracker.min.js -- dist/unomi-tracker.js",
     "snippet:minify": "uglifyjs -c -m -o snippet.min.js -- snippet.js",
@@ -11889,7 +11889,6 @@ module.exports={
     "replace-in-file": "^3.4.2",
     "rimraf": "^2.6.2",
     "uglify-js": "^2.6.4",
-    "watchify": "^3.11.0",
     "yarn": "^1.9.4"
   }
 }
@@ -11939,6 +11938,10 @@ Unomi.prototype.initialize = function(page) {
         if (self[listener]) self[listener](msg);
     });
 
+    this.analytics.personalize = function(personalization, callback) {
+        this.emit('invoke', {action:function() {return "personalize"}, personalization:personalization, callback:callback});
+    };
+
     // Standard to check if cookies are enabled in this browser
     if (!navigator.cookieEnabled) {
         this.executeFallback();
@@ -11946,11 +11949,9 @@ Unomi.prototype.initialize = function(page) {
     }
 
     // digitalData come from a standard so we can keep the logic around it which can allow complex website to load more complex data
-    if (!window.digitalData) {
-        window.digitalData = {
-            scope: this.options.scope
-        };
-    }
+    window.digitalData = window.digitalData || {
+        scope: this.options.scope
+    };
 
     if (page) {
         var props = page.json().properties;
@@ -11959,9 +11960,7 @@ Unomi.prototype.initialize = function(page) {
             unomiPage = window.digitalData.page = { pageInfo:{} }
         }
         this.fillPageData(unomiPage, props);
-        if (!window.digitalData.events) {
-            window.digitalData.events = []
-        }
+        window.digitalData.events = window.digitalData.events || [];
         window.digitalData.events.push(this.buildEvent('view', this.buildPage(unomiPage), this.buildSource(this.options.scope, 'site')))
     }
 
@@ -11978,8 +11977,7 @@ Unomi.prototype.initialize = function(page) {
         this.sessionId = this.options.sessionId;
     }
 
-
-    this.loadContext();
+    setTimeout(this.loadContext.bind(this), 0);
 };
 
 /**
@@ -12083,17 +12081,16 @@ Unomi.prototype.loadContext = function (skipEvents, invalidate) {
 
         self.ready();
 
-        if (window.digitalData.loadCallbacks && window.digitalData.loadCallbacks.length > 0) {
+        if (window.digitalData.loadCallbacks) {
             console.info('[UNOMI] Found context server load callbacks, calling now...');
-            if (window.digitalData.loadCallbacks) {
-                for (var i = 0; i < window.digitalData.loadCallbacks.length; i++) {
-                    window.digitalData.loadCallbacks[i](digitalData);
-                }
+            for (var i = 0; i < window.digitalData.loadCallbacks.length; i++) {
+                window.digitalData.loadCallbacks[i](digitalData);
             }
-            if (window.digitalData.personalizationCallback) {
-                for (var i = 0; i < window.digitalData.personalizationCallback.length; i++) {
-                    window.digitalData.personalizationCallback[i].callback(cxs.personalizations[window.digitalData.personalizationCallback[i].personalization.id]);
-                }
+        }
+        if (window.digitalData.personalizationCallback) {
+            console.info('[UNOMI] Found context server personalization, calling now...');
+            for (var i = 0; i < window.digitalData.personalizationCallback.length; i++) {
+                window.digitalData.personalizationCallback[i].callback(cxs.personalizations[window.digitalData.personalizationCallback[i].personalization.id]);
             }
         }
     };
@@ -12113,6 +12110,17 @@ Unomi.prototype.loadContext = function (skipEvents, invalidate) {
     console.info('[UNOMI] context loading...');
 };
 
+Unomi.prototype.onpersonalize = function (msg) {
+    if (window.cxs) {
+        console.error('[WEM] already loaded, too late...');
+    }
+    window.digitalData = window.digitalData || {
+        scope: this.options.scope
+    };
+    window.digitalData.personalizationCallback = window.digitalData.personalizationCallback || [];
+    window.digitalData.personalizationCallback.push({personalization: msg.personalization, callback: msg.callback});
+},
+
 /**
  * This function return the basic structure for an event, it must be adapted to your need
  *

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b4b0560b/extensions/web-tracker/javascript/dist/unomi-tracker.min.js
----------------------------------------------------------------------
diff --git a/extensions/web-tracker/javascript/dist/unomi-tracker.min.js b/extensions/web-tracker/javascript/dist/unomi-tracker.min.js
index 036c534..499fbcb 100644
--- a/extensions/web-tracker/javascript/dist/unomi-tracker.min.js
+++ b/extensions/web-tracker/javascript/dist/unomi-tracker.min.js
@@ -25,4 +25,4 @@ return this.prototype.globals.push(t),this},n.assumesPageview=function(){return
  * @license MIT
  */
 var r,o=Object.prototype,i=o.hasOwnProperty,a=o.toString;"function"==typeof Symbol&&(r=Symbol.prototype.valueOf);var s=function(t){return t!==t},c={boolean:1,number:1,string:1,undefined:1},u=/^([A-Za-z0-9+\/]{4})*([A-Za-z0-9+\/]{4}|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{2}==)$/,p=/^[A-Fa-f0-9]+$/,l={};l.a=l.type=function(t,e){return typeof t===e},l.defined=function(t){return void 0!==t},l.empty=function(t){var e,n=a.call(t);if("[object Array]"===n||"[object Arguments]"===n||"[object String]"===n)return 0===t.length;if("[object Object]"===n){for(e in t)if(i.call(t,e))return!1;return!0}return!t},l.equal=function(t,e){if(t===e)return!0;var n,r=a.call(t);if(r!==a.call(e))return!1;if("[object Object]"===r){for(n in t)if(!(l.equal(t[n],e[n])&&n in e))return!1;for(n in e)if(!(l.equal(t[n],e[n])&&n in t))return!1;return!0}if("[object Array]"===r){if((n=t.length)!==e.length)return!1;for(;n--;)if(!l.equal(t[n],e[n]))return!1;return!0}return"[object Function]"===r?t.prototype===e.prototype:"[object
  Date]"===r&&t.getTime()===e.getTime()},l.hosted=function(t,e){var n=typeof e[t];return"object"===n?!!e[t]:!c[n]},l.instance=l.instanceof=function(t,e){return t instanceof e},l.nil=l.null=function(t){return null===t},l.undef=l.undefined=function(t){return void 0===t},l.args=l.arguments=function(t){var e="[object Arguments]"===a.call(t),n=!l.array(t)&&l.arraylike(t)&&l.object(t)&&l.fn(t.callee);return e||n},l.array=Array.isArray||function(t){return"[object Array]"===a.call(t)},l.args.empty=function(t){return l.args(t)&&0===t.length},l.array.empty=function(t){return l.array(t)&&0===t.length},l.arraylike=function(t){return!!t&&!l.bool(t)&&i.call(t,"length")&&isFinite(t.length)&&l.number(t.length)&&t.length>=0},l.bool=l.boolean=function(t){return"[object Boolean]"===a.call(t)},l.false=function(t){return l.bool(t)&&!1===Boolean(Number(t))},l.true=function(t){return l.bool(t)&&!0===Boolean(Number(t))},l.date=function(t){return"[object Date]"===a.call(t)},l.date.valid=function(t){return l.
 date(t)&&!isNaN(Number(t))},l.element=function(t){return void 0!==t&&"undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&1===t.nodeType},l.error=function(t){return"[object Error]"===a.call(t)},l.fn=l.function=function(t){if("undefined"!=typeof window&&t===window.alert)return!0;var e=a.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e||"[object AsyncFunction]"===e},l.number=function(t){return"[object Number]"===a.call(t)},l.infinite=function(t){return t===1/0||t===-1/0},l.decimal=function(t){return l.number(t)&&!s(t)&&!l.infinite(t)&&t%1!=0},l.divisibleBy=function(t,e){var n=l.infinite(t),r=l.infinite(e),o=l.number(t)&&!s(t)&&l.number(e)&&!s(e)&&0!==e;return n||r||o&&t%e==0},l.integer=l.int=function(t){return l.number(t)&&!s(t)&&t%1==0},l.maximum=function(t,e){if(s(t))throw new TypeError("NaN is not a valid value");if(!l.arraylike(e))throw new TypeError("second argument must be array-like");for(var n=e.length;--n>=0;)if(t<e[n])return!1;return!0},l.minimum
 =function(t,e){if(s(t))throw new TypeError("NaN is not a valid value");if(!l.arraylike(e))throw new TypeError("second argument must be array-like");for(var n=e.length;--n>=0;)if(t>e[n])return!1;return!0},l.nan=function(t){return!l.number(t)||t!==t},l.even=function(t){return l.infinite(t)||l.number(t)&&t===t&&t%2==0},l.odd=function(t){return l.infinite(t)||l.number(t)&&t===t&&t%2!=0},l.ge=function(t,e){if(s(t)||s(e))throw new TypeError("NaN is not a valid value");return!l.infinite(t)&&!l.infinite(e)&&t>=e},l.gt=function(t,e){if(s(t)||s(e))throw new TypeError("NaN is not a valid value");return!l.infinite(t)&&!l.infinite(e)&&t>e},l.le=function(t,e){if(s(t)||s(e))throw new TypeError("NaN is not a valid value");return!l.infinite(t)&&!l.infinite(e)&&t<=e},l.lt=function(t,e){if(s(t)||s(e))throw new TypeError("NaN is not a valid value");return!l.infinite(t)&&!l.infinite(e)&&t<e},l.within=function(t,e,n){if(s(t)||s(e)||s(n))throw new TypeError("NaN is not a valid value");if(!l.number(t)||!l.
 number(e)||!l.number(n))throw new TypeError("all arguments must be numbers");return l.infinite(t)||l.infinite(e)||l.infinite(n)||t>=e&&t<=n},l.object=function(t){return"[object Object]"===a.call(t)},l.primitive=function(t){return!t||!("object"==typeof t||l.object(t)||l.fn(t)||l.array(t))},l.hash=function(t){return l.object(t)&&t.constructor===Object&&!t.nodeType&&!t.setInterval},l.regexp=function(t){return"[object RegExp]"===a.call(t)},l.string=function(t){return"[object String]"===a.call(t)},l.base64=function(t){return l.string(t)&&(!t.length||u.test(t))},l.hex=function(t){return l.string(t)&&(!t.length||p.test(t))},l.symbol=function(t){return"function"==typeof Symbol&&"[object Symbol]"===a.call(t)&&"symbol"==typeof r.call(t)},e.exports=l},{}],63:[function(e,n,r){(function(e){(function(){function o(t,e){function n(t){if(n[t]!==g)return n[t];var o;if("bug-string-char-index"==t)o="a"!="a"[0];else if("json"==t)o=n("json-stringify")&&n("json-parse");else{var a,s='{"a":[1,true,false,nul
 l,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==t){var c=e.stringify,p="function"==typeof c&&b;if(p){(a=function(){return 1}).toJSON=a;try{p="0"===c(0)&&"0"===c(new r)&&'""'==c(new i)&&c(v)===g&&c(g)===g&&c()===g&&"1"===c(a)&&"[1]"==c([a])&&"[null]"==c([g])&&"null"==c(null)&&"[null,null,null]"==c([g,v,null])&&c({a:[a,!0,!1,null,"\0\b\n\f\r\t"]})==s&&"1"===c(null,a)&&"[\n 1,\n 2\n]"==c([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==c(new u(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==c(new u(864e13))&&'"-000001-01-01T00:00:00.000Z"'==c(new u(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==c(new u(-1))}catch(t){p=!1}}o=p}if("json-parse"==t){var l=e.parse;if("function"==typeof l)try{if(0===l("0")&&!l(!1)){a=l(s);var f=5==a.a.length&&1===a.a[0];if(f){try{f=!l('"\t"')}catch(t){}if(f)try{f=1!==l("01")}catch(t){}if(f)try{f=1!==l("1.")}catch(t){}}}}catch(t){f=!1}o=f}}return n[t]=!!o}t||(t=c.Object()),e||(e=c.Object());var r=t.Number||c.Number,i=t.String||c.String,s=t.Object||c.Object,u=t.D
 ate||c.Date,p=t.SyntaxError||c.SyntaxError,l=t.TypeError||c.TypeError,f=t.Math||c.Math,d=t.JSON||c.JSON;"object"==typeof d&&d&&(e.stringify=d.stringify,e.parse=d.parse);var h,y,g,m=s.prototype,v=m.toString,b=new u(-0xc782b5b800cec);try{b=-109252==b.getUTCFullYear()&&0===b.getUTCMonth()&&1===b.getUTCDate()&&10==b.getUTCHours()&&37==b.getUTCMinutes()&&6==b.getUTCSeconds()&&708==b.getUTCMilliseconds()}catch(t){}if(!n("json")){var w=n("bug-string-char-index");if(!b)var _=f.floor,x=[0,31,59,90,120,151,181,212,243,273,304,334],j=function(t,e){return x[e]+365*(t-1970)+_((t-1969+(e=+(e>1)))/4)-_((t-1901+e)/100)+_((t-1601+e)/400)};if((h=m.hasOwnProperty)||(h=function(t){var e,n={};return(n.__proto__=null,n.__proto__={toString:1},n).toString!=v?h=function(t){var e=this.__proto__,n=t in(this.__proto__=null,this);return this.__proto__=e,n}:(e=n.constructor,h=function(t){var n=(this.constructor||e).prototype;return t in this&&!(t in n&&this[t]===n[t])}),n=null,h.call(this,t)}),y=function(t,e){va
 r n,r,o,i=0;(n=function(){this.valueOf=0}).prototype.valueOf=0,r=new n;for(o in r)h.call(r,o)&&i++;return n=r=null,i?y=2==i?function(t,e){var n,r={},o="[object Function]"==v.call(t);for(n in t)o&&"prototype"==n||h.call(r,n)||!(r[n]=1)||!h.call(t,n)||e(n)}:function(t,e){var n,r,o="[object Function]"==v.call(t);for(n in t)o&&"prototype"==n||!h.call(t,n)||(r="constructor"===n)||e(n);(r||h.call(t,n="constructor"))&&e(n)}:(r=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],y=function(t,e){var n,o,i="[object Function]"==v.call(t),s=!i&&"function"!=typeof t.constructor&&a[typeof t.hasOwnProperty]&&t.hasOwnProperty||h;for(n in t)i&&"prototype"==n||!s.call(t,n)||e(n);for(o=r.length;n=r[--o];s.call(t,n)&&e(n));}),y(t,e)},!n("json-stringify")){var k={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},I=function(t,e){return("000000"+(e||0)).slice(-t)},T=function(t){for(var e='"',n=0,r=t.length,o=!w||r>10,i=o&&(w?t.split(""
 ):t);n<r;n++){var a=t.charCodeAt(n);switch(a){case 8:case 9:case 10:case 12:case 13:case 34:case 92:e+=k[a];break;default:if(a<32){e+="\\u00"+I(2,a.toString(16));break}e+=o?i[n]:t.charAt(n)}}return e+'"'},O=function(t,e,n,r,o,i,a){var s,c,u,p,f,d,m,b,w,x,k,C,A,S,E,D;try{s=e[t]}catch(t){}if("object"==typeof s&&s)if("[object Date]"!=(c=v.call(s))||h.call(s,"toJSON"))"function"==typeof s.toJSON&&("[object Number]"!=c&&"[object String]"!=c&&"[object Array]"!=c||h.call(s,"toJSON"))&&(s=s.toJSON(t));else if(s>-1/0&&s<1/0){if(j){for(f=_(s/864e5),u=_(f/365.2425)+1970-1;j(u+1,0)<=f;u++);for(p=_((f-j(u,0))/30.42);j(u,p+1)<=f;p++);f=1+f-j(u,p),d=(s%864e5+864e5)%864e5,m=_(d/36e5)%24,b=_(d/6e4)%60,w=_(d/1e3)%60,x=d%1e3}else u=s.getUTCFullYear(),p=s.getUTCMonth(),f=s.getUTCDate(),m=s.getUTCHours(),b=s.getUTCMinutes(),w=s.getUTCSeconds(),x=s.getUTCMilliseconds();s=(u<=0||u>=1e4?(u<0?"-":"+")+I(6,u<0?-u:u):I(4,u))+"-"+I(2,p+1)+"-"+I(2,f)+"T"+I(2,m)+":"+I(2,b)+":"+I(2,w)+"."+I(3,x)+"Z"}else s=null;i
 f(n&&(s=n.call(e,t,s)),null===s)return"null";if("[object Boolean]"==(c=v.call(s)))return""+s;if("[object Number]"==c)return s>-1/0&&s<1/0?""+s:"null";if("[object String]"==c)return T(""+s);if("object"==typeof s){for(S=a.length;S--;)if(a[S]===s)throw l();if(a.push(s),k=[],E=i,i+=o,"[object Array]"==c){for(A=0,S=s.length;A<S;A++)C=O(A,s,n,r,o,i,a),k.push(C===g?"null":C);D=k.length?o?"[\n"+i+k.join(",\n"+i)+"\n"+E+"]":"["+k.join(",")+"]":"[]"}else y(r||s,function(t){var e=O(t,s,n,r,o,i,a);e!==g&&k.push(T(t)+":"+(o?" ":"")+e)}),D=k.length?o?"{\n"+i+k.join(",\n"+i)+"\n"+E+"}":"{"+k.join(",")+"}":"{}";return a.pop(),D}};e.stringify=function(t,e,n){var r,o,i,s;if(a[typeof e]&&e)if("[object Function]"==(s=v.call(e)))o=e;else if("[object Array]"==s){i={};for(var c,u=0,p=e.length;u<p;c=e[u++],("[object String]"==(s=v.call(c))||"[object Number]"==s)&&(i[c]=1));}if(n)if("[object Number]"==(s=v.call(n))){if((n-=n%1)>0)for(r="",n>10&&(n=10);r.length<n;r+=" ");}else"[object String]"==s&&(r=n.lengt
 h<=10?n:n.slice(0,10));return O("",(c={},c[""]=t,c),o,i,r,"",[])}}if(!n("json-parse")){var C,A,S=i.fromCharCode,E={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},D=function(){throw C=A=null,p()},N=function(){for(var t,e,n,r,o,i=A,a=i.length;C<a;)switch(o=i.charCodeAt(C)){case 9:case 10:case 13:case 32:C++;break;case 123:case 125:case 91:case 93:case 58:case 44:return t=w?i.charAt(C):i[C],C++,t;case 34:for(t="@",C++;C<a;)if((o=i.charCodeAt(C))<32)D();else if(92==o)switch(o=i.charCodeAt(++C)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:t+=E[o],C++;break;case 117:for(e=++C,n=C+4;C<n;C++)(o=i.charCodeAt(C))>=48&&o<=57||o>=97&&o<=102||o>=65&&o<=70||D();t+=S("0x"+i.slice(e,C));break;default:D()}else{if(34==o)break;for(o=i.charCodeAt(C),e=C;o>=32&&92!=o&&34!=o;)o=i.charCodeAt(++C);t+=i.slice(e,C)}if(34==i.charCodeAt(C))return C++,t;D();default:if(e=C,45==o&&(r=!0,o=i.charCodeAt(++C)),o>=48&&o<=57){for(48==o&&(o=i.charCodeAt(C+1))>=48&&o<=57&&D(),
 r=!1;C<a&&(o=i.charCodeAt(C))>=48&&o<=57;C++);if(46==i.charCodeAt(C)){for(n=++C;n<a&&(o=i.charCodeAt(n))>=48&&o<=57;n++);n==C&&D(),C=n}if(101==(o=i.charCodeAt(C))||69==o){for(o=i.charCodeAt(++C),43!=o&&45!=o||C++,n=C;n<a&&(o=i.charCodeAt(n))>=48&&o<=57;n++);n==C&&D(),C=n}return+i.slice(e,C)}if(r&&D(),"true"==i.slice(C,C+4))return C+=4,!0;if("false"==i.slice(C,C+5))return C+=5,!1;if("null"==i.slice(C,C+4))return C+=4,null;D()}return"$"},z=function(t){var e,n;if("$"==t&&D(),"string"==typeof t){if("@"==(w?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(e=[];"]"!=(t=N());n||(n=!0))n&&(","==t?"]"==(t=N())&&D():D()),","==t&&D(),e.push(z(t));return e}if("{"==t){for(e={};"}"!=(t=N());n||(n=!0))n&&(","==t?"}"==(t=N())&&D():D()),","!=t&&"string"==typeof t&&"@"==(w?t.charAt(0):t[0])&&":"==N()||D(),e[t.slice(1)]=z(N());return e}D()}return t},$=function(t,e,n){var r=P(t,e,n);r===g?delete t[e]:t[e]=r},P=function(t,e,n){var r,o=t[e];if("object"==typeof o&&o)if("[object Array]"==v.call(o))for(r=
 o.length;r--;)$(o,r,n);else y(o,function(t){$(o,t,n)});return n.call(t,e,o)};e.parse=function(t,e){var n,r;return C=0,A=""+t,n=z(N()),"$"!=N()&&D(),C=A=null,e&&"[object Function]"==v.call(e)?P((r={},r[""]=n,r),"",e):n}}}return e.runInContext=o,e}var i="function"==typeof t&&t.amd,a={function:!0,object:!0},s=a[typeof r]&&r&&!r.nodeType&&r,c=a[typeof window]&&window||this,u=s&&a[typeof n]&&n&&!n.nodeType&&"object"==typeof e&&e;if(!u||u.global!==u&&u.window!==u&&u.self!==u||(c=u),s&&!i)o(c,s);else{var p=c.JSON,l=c.JSON3,f=!1,d=o(c,c.JSON3={noConflict:function(){return f||(f=!0,c.JSON=p,c.JSON3=l,p=l=null),d}});c.JSON={parse:d.parse,stringify:d.stringify}}i&&t(function(){return d})}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],64:[function(t,e,n){function r(){}function o(t,e,n){function o(){c.parentNode&&c.parentNode.removeChild(c),window[l]=r,u&&clearTimeout(u)}function s(){window[l]&&o()}"function"==t
 ypeof e&&(n=e,e={}),e||(e={});var c,u,p=e.prefix||"__jp",l=e.name||p+a++,f=e.param||"callback",d=null!=e.timeout?e.timeout:6e4,h=encodeURIComponent,y=document.getElementsByTagName("script")[0]||document.head;return d&&(u=setTimeout(function(){o(),n&&n(new Error("Timeout"))},d)),window[l]=function(t){i("jsonp got",t),o(),n&&n(null,t)},t+=(~t.indexOf("?")?"&":"?")+f+"="+h(l),t=t.replace("?&","?"),i('jsonp req "%s"',t),c=document.createElement("script"),c.src=t,y.parentNode.insertBefore(c,y),s}var i=t("debug")("jsonp");e.exports=o;var a=0},{debug:55}],65:[function(t,e,n){var r=t("is"),o=t("script-onload"),i=t("next-tick");e.exports=function(t,e){if(!t)throw new Error("Cant load nothing...");r.string(t)&&(t={src:t});var n="https:"===document.location.protocol||"chrome-extension:"===document.location.protocol;t.src&&0===t.src.indexOf("//")&&(t.src=n?"https:"+t.src:"http:"+t.src),n&&t.https?t.src=t.https:!n&&t.http&&(t.src=t.http);var a=document.createElement("iframe");return a.src=t.src,
 a.width=t.width||1,a.height=t.height||1,a.style.display="none",r.fn(e)&&o(a,e),i(function(){var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(a,t)}),a}},{is:62,"next-tick":71,"script-onload":74}],66:[function(t,e,n){function r(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*p;case"hours":case"hour":case"hrs":case"hr":case"h":return n*u;case"minutes":case"minute":case"mins":case"min":case"m":return n*c;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function o(t){return t>=p?Math.round(t/p)+"d":t>=u?Math.round(t/u)+"h":t>=c?Math.round(t/c)+"m":t>=s?Math.round(t/s)+"s"
 :t+"ms"}function i(t){return a(t,p,"day")||a(t,u,"hour")||a(t,c,"minute")||a(t,s,"second")||t+" ms"}function a(t,e,n){if(!(t<e))return t<1.5*e?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var s=1e3,c=60*s,u=60*c,p=24*u,l=365.25*p;e.exports=function(t,e){e=e||{};var n=typeof t;if("string"===n&&t.length>0)return r(t);if("number"===n&&!1===isNaN(t))return e.long?i(t):o(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},{}],67:[function(t,e,n){"use strict";function r(t){return t<315576e5?1e3*t:t}var o=t("is"),i=t("@segment/isodate"),a=t("./milliseconds"),s=t("./seconds");e.exports=function(t){return o.date(t)?t:o.number(t)?new Date(r(t)):i.is(t)?i.parse(t):a.is(t)?a.parse(t):s.is(t)?s.parse(t):new Date(t)}},{"./milliseconds":68,"./seconds":69,"@segment/isodate":70,is:62}],68:[function(t,e,n){"use strict";var r=/\d{13}/;n.is=function(t){return r.test(t)},n.parse=function(t){return t=parseInt(t,10),new Date(t)}},{}],69:[function(t,e,n){"use s
 trict";var r=/\d{10}/;n.is=function(t){return r.test(t)},n.parse=function(t){var e=1e3*parseInt(t,10);return new Date(e)}},{}],70:[function(t,e,n){"use strict";var r=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;n.parse=function(t){var e=[1,5,6,7,11,12],n=r.exec(t),o=0;if(!n)return new Date(t);for(var i,a=0;i=e[a];a++)n[i]=parseInt(n[i],10)||0;n[2]=parseInt(n[2],10)||1,n[3]=parseInt(n[3],10)||1,n[2]--,n[8]=n[8]?(n[8]+"00").substring(0,3):0," "===n[4]?o=(new Date).getTimezoneOffset():"Z"!==n[9]&&n[10]&&(o=60*n[11]+n[12],"+"===n[10]&&(o=0-o));var s=Date.UTC(n[1],n[2],n[3],n[5],n[6]+o,n[7],n[8]);return new Date(s)},n.is=function(t,e){return(!e||!1!==/^\d{4}-\d{2}-\d{2}/.test(t))&&r.test(t)}},{}],71:[function(t,e,n){(function(t,n){"use strict";var r,o;r=function(t){if("function"!=typeof t)throw new TypeError(t+" is not a function");return t},o=function(t){var e,n=document.createTextNode(""),o=0;ret
 urn new t(function(){var t;if(e){if(t=e,e=null,"function"==typeof t)return void t();t.forEach(function(t){t()})}}).observe(n,{characterData:!0}),function(t){if(r(t),e)return void("function"==typeof e?e=[e,t]:e.push(t));e=t,n.data=o=++o%2}},e.exports=function(){if(void 0!==t&&t&&"function"==typeof t.nextTick)return t.nextTick;if("object"==typeof document&&document){if("function"==typeof MutationObserver)return o(MutationObserver);if("function"==typeof WebKitMutationObserver)return o(WebKitMutationObserver)}return"function"==typeof n?function(t){n(r(t))}:"function"==typeof setTimeout?function(t){setTimeout(r(t),0)}:null}()}).call(this,t("_process"),t("timers").setImmediate)},{_process:73,timers:88}],72:[function(t,e,n){function r(t){return function(e,n,r,o){normalize=o&&c(o.normalizer)?o.normalizer:s,n=normalize(n);for(var i,a=!1;!a;)!function(){for(i in e){var t=normalize(i);if(0===n.indexOf(t)){var r=n.substr(t.length);if("."===r.charAt(0)||0===r.length){n=r.substr(1);var o=e[i];ret
 urn null==o?void(a=!0):n.length?void(e=o):void(a=!0)}}}i=void 0,a=!0}();if(i)return null==e?e:t(e,i,r)}}function o(t,e){if(t.hasOwnProperty(e))return t[e]}function i(t,e){return t.hasOwnProperty(e)&&delete t[e],t}function a(t,e,n){return t.hasOwnProperty(e)&&(t[e]=n),t}function s(t){return t.replace(/[^a-zA-Z0-9\.]+/g,"").toLowerCase()}function c(t){return"function"==typeof t}e.exports=r(o),e.exports.find=e.exports,e.exports.replace=function(t,e,n,o){return r(a).call(this,t,e,n,o),t},e.exports.del=function(t,e,n){return r(i).call(this,t,e,null,n),t}},{}],73:[function(t,e,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(t){if(l===setTimeout)return setTimeout(t,0);if((l===r||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function a(t){if(f===clearTimeout)return clearTimeout(t);if((f===o||!f)&&clear
 Timeout)return f=clearTimeout,clearTimeout(t);try{return f(t)}catch(e){try{return f.call(null,t)}catch(e){return f.call(this,t)}}}function s(){g&&h&&(g=!1,h.length?y=h.concat(y):m=-1,y.length&&c())}function c(){if(!g){var t=i(s);g=!0;for(var e=y.length;e;){for(h=y,y=[];++m<e;)h&&h[m].run();m=-1,e=y.length}h=null,g=!1,a(t)}}function u(t,e){this.fun=t,this.array=e}function p(){}var l,f,d=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:r}catch(t){l=r}try{f="function"==typeof clearTimeout?clearTimeout:o}catch(t){f=o}}();var h,y=[],g=!1,m=-1;d.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];y.push(new u(t,e)),1!==y.length||g||i(c)},u.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=p,d.addListener=p,d.once=p,d.off=p,d.removeListener=p,d.removeAllListeners=p,d.emit=p,d.prependListener=p,d.pr
 ependOnceListener=p,d.listeners=function(t){return[]},d.binding=function(t){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(t){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}},{}],74:[function(t,e,n){function r(t,e){t.addEventListener("load",function(t,n){e(null,n)},!1),t.addEventListener("error",function(n){var r=new Error('script error "'+t.src+'"');r.event=n,e(r)},!1)}function o(t,e){t.attachEvent("onreadystatechange",function(n){/complete|loaded/.test(t.readyState)&&e(null,n)}),t.attachEvent("onerror",function(n){var r=new Error('failed to load the script "'+t.src+'"');r.event=n||window.event,e(r)})}e.exports=function(t,e){return t.addEventListener?r(t,e):o(t,e)}},{}],75:[function(t,e,n){"use strict";var r=t("obj-case");e.exports=function(t){function e(t,e){return function(){var n=this.traits(),o=this.properties?this.properties():{};return r(n,"address."+t)||r(n,t)||(e?r(n,"address."+e):null)||(e?r
 (n,e):null)||r(o,"address."+t)||r(o,t)||(e?r(o,"address."+e):null)||(e?r(o,e):null)}}t.zip=e("postalCode","zip"),t.country=e("country"),t.street=e("street"),t.state=e("state"),t.city=e("city"),t.region=e("region")}},{"obj-case":72}],76:[function(t,e,n){"use strict";function r(t,e){i.call(this,t,e)}var o=t("./utils").inherit,i=t("./facade");o(r,i),r.prototype.action=function(){return"alias"},r.prototype.type=r.prototype.action,r.prototype.previousId=function(){return this.field("previousId")||this.field("from")},r.prototype.from=r.prototype.previousId,r.prototype.userId=function(){return this.field("userId")||this.field("to")},r.prototype.to=r.prototype.userId,e.exports=r},{"./facade":78,"./utils":86}],77:[function(t,e,n){"use strict";function r(t,e){i.call(this,t,e)}var o=t("./utils").inherit,i=t("./facade");o(r,i),r.prototype.type=function(){return"delete"},e.exports=r},{"./facade":78,"./utils":86}],78:[function(t,e,n){"use strict";function r(t,e){e=e||{},"clone"in e||(e.clone=!0),
 e.clone&&(t=a(t)),"traverse"in e||(e.traverse=!0),t.timestamp="timestamp"in t?c(t.timestamp):new Date,e.traverse&&p(t),this.opts=e,this.obj=t}function o(t){return a(t)}var i=t("./address"),a=t("./utils").clone,s=t("./is-enabled"),c=t("new-date"),u=t("obj-case"),p=t("@segment/isodate-traverse"),l=t("./utils").type;r.prototype.proxy=function(t){var e=t.split(".");t=e.shift();var n=this[t]||this.field(t);return n?("function"==typeof n&&(n=n.call(this)||{}),0===e.length?this.opts.clone?o(n):n:(n=u(n,e.join(".")),this.opts.clone?o(n):n)):n},r.prototype.field=function(t){var e=this.obj[t];return this.opts.clone?o(e):e},r.proxy=function(t){return function(){return this.proxy(t)}},r.field=function(t){return function(){return this.field(t)}},r.multi=function(t){return function(){var e=this.proxy(t+"s");if("array"===l(e))return e;var n=this.proxy(t);return n&&(n=[this.opts.clone?a(n):n]),n||[]}},r.one=function(t){return function(){var e=this.proxy(t);if(e)return e;var n=this.proxy(t+"s");retu
 rn"array"===l(n)?n[0]:void 0}},r.prototype.json=function(){var t=this.opts.clone?a(this.obj):this.obj;return this.type&&(t.type=this.type()),t},r.prototype.options=function(t){var e=this.obj.options||this.obj.context||{},n=this.opts.clone?a(e):e;if(!t)return n;if(this.enabled(t)){var r=this.integrations(),o=r[t]||u(r,t);return"object"!=typeof o&&(o=u(this.options(),t)),"object"==typeof o?o:{}}},r.prototype.context=r.prototype.options,r.prototype.enabled=function(t){var e=this.proxy("options.providers.all");"boolean"!=typeof e&&(e=this.proxy("options.all")),"boolean"!=typeof e&&(e=this.proxy("integrations.all")),"boolean"!=typeof e&&(e=!0);var n=e&&s(t),r=this.integrations();if(r.providers&&r.providers.hasOwnProperty(t)&&(n=r.providers[t]),r.hasOwnProperty(t)){var o=r[t];n="boolean"!=typeof o||o}return!!n},r.prototype.integrations=function(){return this.obj.integrations||this.proxy("options.providers")||this.options()},r.prototype.active=function(){var t=this.proxy("options.active");
 return null!==t&&void 0!==t||(t=!0),t},r.prototype.anonymousId=function(){return this.field("anonymousId")||this.field("sessionId")},r.prototype.sessionId=r.prototype.anonymousId,r.prototype.groupId=r.proxy("options.groupId"),r.prototype.traits=function(t){var e=this.proxy("options.traits")||{},n=this.userId();t=t||{},n&&(e.id=n);for(var r in t){var o=null==this[r]?this.proxy("options.traits."+r):this[r]();null!=o&&(e[t[r]]=o,delete e[r])}return e},r.prototype.library=function(){var t=this.proxy("options.library");return t?"string"==typeof t?{name:t,version:null}:t:{name:"unknown",version:null}},r.prototype.device=function(){var t=this.proxy("context.device");"object"!==l(t)&&(t={});var e=this.library().name;return t.type?t:(e.indexOf("ios")>-1&&(t.type="ios"),e.indexOf("android")>-1&&(t.type="android"),t)},r.prototype.userAgent=r.proxy("context.userAgent"),r.prototype.timezone=r.proxy("context.timezone"),r.prototype.timestamp=r.field("timestamp"),r.prototype.channel=r.field("channe
 l"),r.prototype.ip=r.proxy("context.ip"),r.prototype.userId=r.field("userId"),i(r.prototype),e.exports=r},{"./address":75,"./is-enabled":82,"./utils":86,"@segment/isodate-traverse":35,"new-date":67,"obj-case":72}],79:[function(t,e,n){"use strict";function r(t,e){s.call(this,t,e)}var o=t("./utils").inherit,i=t("is-email"),a=t("new-date"),s=t("./facade");o(r,s),r.prototype.action=function(){return"group"},r.prototype.type=r.prototype.action,r.prototype.groupId=s.field("groupId"),r.prototype.created=function(){var t=this.proxy("traits.createdAt")||this.proxy("traits.created")||this.proxy("properties.createdAt")||this.proxy("properties.created");if(t)return a(t)},r.prototype.email=function(){var t=this.proxy("traits.email");if(t)return t;var e=this.groupId();return i(e)?e:void 0},r.prototype.traits=function(t){var e=this.properties(),n=this.groupId();t=t||{},n&&(e.id=n);for(var r in t){var o=null==this[r]?this.proxy("traits."+r):this[r]();null!=o&&(e[t[r]]=o,delete e[r])}return e},r.pro
 totype.name=s.proxy("traits.name"),r.prototype.industry=s.proxy("traits.industry"),r.prototype.employees=s.proxy("traits.employees"),r.prototype.properties=function(){return this.field("traits")||this.field("properties")||{}},e.exports=r},{"./facade":78,"./utils":86,"is-email":61,"new-date":67}],80:[function(t,e,n){"use strict";function r(t,e){o.call(this,t,e)}var o=t("./facade"),i=t("obj-case"),a=t("./utils").inherit,s=t("is-email"),c=t("new-date"),u=t("trim"),p=t("./utils").type;a(r,o),r.prototype.action=function(){return"identify"},r.prototype.type=r.prototype.action,r.prototype.traits=function(t){var e=this.field("traits")||{},n=this.userId();t=t||{},n&&(e.id=n);for(var r in t){var o=null==this[r]?this.proxy("traits."+r):this[r]();null!=o&&(e[t[r]]=o,r!==t[r]&&delete e[r])}return e},r.prototype.email=function(){var t=this.proxy("traits.email");if(t)return t;var e=this.userId();return s(e)?e:void 0},r.prototype.created=function(){var t=this.proxy("traits.created")||this.proxy("tr
 aits.createdAt");if(t)return c(t)},r.prototype.companyCreated=function(){var t=this.proxy("traits.company.created")||this.proxy("traits.company.createdAt");if(t)return c(t)},r.prototype.companyName=function(){return this.proxy("traits.company.name")},r.prototype.name=function(){var t=this.proxy("traits.name");if("string"==typeof t)return u(t);var e=this.firstName(),n=this.lastName();return e&&n?u(e+" "+n):void 0},r.prototype.firstName=function(){var t=this.proxy("traits.firstName");if("string"==typeof t)return u(t);var e=this.proxy("traits.name");return"string"==typeof e?u(e).split(" ")[0]:void 0},r.prototype.lastName=function(){var t=this.proxy("traits.lastName");if("string"==typeof t)return u(t);var e=this.proxy("traits.name");if("string"==typeof e){var n=u(e).indexOf(" ");if(-1!==n)return u(e.substr(n+1))}},r.prototype.uid=function(){return this.userId()||this.username()||this.email()},r.prototype.description=function(){return this.proxy("traits.description")||this.proxy("traits.
 background")},r.prototype.age=function(){var t=this.birthday(),e=i(this.traits(),"age");if(null!=e)return e;if("date"===p(t)){return(new Date).getFullYear()-t.getFullYear()}},r.prototype.avatar=function(){var t=this.traits();return i(t,"avatar")||i(t,"photoUrl")||i(t,"avatarUrl")},r.prototype.position=function(){var t=this.traits();return i(t,"position")||i(t,"jobTitle")},r.prototype.username=o.proxy("traits.username"),r.prototype.website=o.one("traits.website"),r.prototype.websites=o.multi("traits.website"),r.prototype.phone=o.one("traits.phone"),r.prototype.phones=o.multi("traits.phone"),r.prototype.address=o.proxy("traits.address"),r.prototype.gender=o.proxy("traits.gender"),r.prototype.birthday=o.proxy("traits.birthday"),e.exports=r},{"./facade":78,"./utils":86,"is-email":61,"new-date":67,"obj-case":72,trim:91}],81:[function(t,e,n){"use strict";var r=t("./facade");r.Alias=t("./alias"),r.Group=t("./group"),r.Identify=t("./identify"),r.Track=t("./track"),r.Page=t("./page"),r.Scree
 n=t("./screen"),r.Delete=t("./delete"),e.exports=r},{"./alias":76,"./delete":77,"./facade":78,"./group":79,"./identify":80,"./page":83,"./screen":84,"./track":85}],82:[function(t,e,n){"use strict";var r={Salesforce:!0};e.exports=function(t){return!r[t]}},{}],83:[function(t,e,n){"use strict";function r(t,e){i.call(this,t,e)}var o=t("./utils").inherit,i=t("./facade"),a=t("./track"),s=t("is-email");o(r,i),r.prototype.action=function(){return"page"},r.prototype.type=r.prototype.action,r.prototype.category=i.field("category"),r.prototype.name=i.field("name"),r.prototype.title=i.proxy("properties.title"),r.prototype.path=i.proxy("properties.path"),r.prototype.url=i.proxy("properties.url"),r.prototype.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")},r.prototype.properties=function(t){var e=this.field("properties")||{},n=this.category(),r=this.name();t=t||{},n&&(e.category=n),r&&(e.name=r);for(var o in t){
 var i=null==this[o]?this.proxy("properties."+o):this[o]();null!=i&&(e[t[o]]=i,o!==t[o]&&delete e[o])}return e},r.prototype.email=function(){var t=this.proxy("context.traits.email")||this.proxy("properties.email");if(t)return t;var e=this.userId();return s(e)?e:void 0},r.prototype.fullName=function(){var t=this.category(),e=this.name();return e&&t?t+" "+e:e},r.prototype.event=function(t){return t?"Viewed "+t+" Page":"Loaded a Page"},r.prototype.track=function(t){var e=this.json();return e.event=this.event(t),e.timestamp=this.timestamp(),e.properties=this.properties(),new a(e,this.opts)},e.exports=r},{"./facade":78,"./track":85,"./utils":86,"is-email":61}],84:[function(t,e,n){"use strict";function r(t,e){i.call(this,t,e)}var o=t("./utils").inherit,i=t("./page"),a=t("./track");o(r,i),r.prototype.action=function(){return"screen"},r.prototype.type=r.prototype.action,r.prototype.event=function(t){return t?"Viewed "+t+" Screen":"Loaded a Screen"},r.prototype.track=function(t){var e=this.js
 on();return e.event=this.event(t),e.timestamp=this.timestamp(),e.properties=this.properties(),new a(e,this.opts)},e.exports=r},{"./page":83,"./track":85,"./utils":86}],85:[function(t,e,n){"use strict";function r(t,e){s.call(this,t,e)}function o(t){if(t){if("number"==typeof t)return t;if("string"==typeof t)return t=t.replace(/\$/g,""),t=parseFloat(t),isNaN(t)?void 0:t}}var i=t("./utils").inherit,a=t("./utils").type,s=t("./facade"),c=t("./identify"),u=t("is-email"),p=t("obj-case");i(r,s),r.prototype.action=function(){return"track"},r.prototype.type=r.prototype.action,r.prototype.event=s.field("event"),r.prototype.value=s.proxy("properties.value"),r.prototype.category=s.proxy("properties.category"),r.prototype.id=s.proxy("properties.id"),r.prototype.productId=function(){return this.proxy("properties.product_id")||this.proxy("properties.productId")},r.prototype.promotionId=function(){return this.proxy("properties.promotion_id")||this.proxy("properties.promotionId")},r.prototype.cartId=f
 unction(){return this.proxy("properties.cart_id")||this.proxy("properties.cartId")},
-r.prototype.checkoutId=function(){return this.proxy("properties.checkout_id")||this.proxy("properties.checkoutId")},r.prototype.paymentId=function(){return this.proxy("properties.payment_id")||this.proxy("properties.paymentId")},r.prototype.couponId=function(){return this.proxy("properties.coupon_id")||this.proxy("properties.couponId")},r.prototype.wishlistId=function(){return this.proxy("properties.wishlist_id")||this.proxy("properties.wishlistId")},r.prototype.reviewId=function(){return this.proxy("properties.review_id")||this.proxy("properties.reviewId")},r.prototype.orderId=function(){return this.proxy("properties.id")||this.proxy("properties.order_id")||this.proxy("properties.orderId")},r.prototype.sku=s.proxy("properties.sku"),r.prototype.tax=s.proxy("properties.tax"),r.prototype.name=s.proxy("properties.name"),r.prototype.price=s.proxy("properties.price"),r.prototype.total=s.proxy("properties.total"),r.prototype.repeat=s.proxy("properties.repeat"),r.prototype.coupon=s.proxy("
 properties.coupon"),r.prototype.shipping=s.proxy("properties.shipping"),r.prototype.discount=s.proxy("properties.discount"),r.prototype.shippingMethod=function(){return this.proxy("properties.shipping_method")||this.proxy("properties.shippingMethod")},r.prototype.paymentMethod=function(){return this.proxy("properties.payment_method")||this.proxy("properties.paymentMethod")},r.prototype.description=s.proxy("properties.description"),r.prototype.plan=s.proxy("properties.plan"),r.prototype.subtotal=function(){var t=p(this.properties(),"subtotal"),e=this.total()||this.revenue();if(t)return t;if(!e)return 0;if(this.total()){var n=this.tax();n&&(e-=n),n=this.shipping(),n&&(e-=n),n=this.discount(),n&&(e+=n)}return e},r.prototype.products=function(){var t=this.properties(),e=p(t,"products");return"array"===a(e)?e:[]},r.prototype.quantity=function(){return(this.obj.properties||{}).quantity||1},r.prototype.currency=function(){return(this.obj.properties||{}).currency||"USD"},r.prototype.referre
 r=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")},r.prototype.query=s.proxy("options.query"),r.prototype.properties=function(t){var e=this.field("properties")||{};t=t||{};for(var n in t){var r=null==this[n]?this.proxy("properties."+n):this[n]();null!=r&&(e[t[n]]=r,delete e[n])}return e},r.prototype.username=function(){return this.proxy("traits.username")||this.proxy("properties.username")||this.userId()||this.sessionId()},r.prototype.email=function(){var t=this.proxy("traits.email")||this.proxy("properties.email")||this.proxy("options.traits.email");if(t)return t;var e=this.userId();return u(e)?e:void 0},r.prototype.revenue=function(){var t=this.proxy("properties.revenue"),e=this.event(),n=/^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i;return!t&&e&&e.match(n)&&(t=this.proxy("properties.total")),o(t)},r.prototype.cents=function(){var t=this.revenue();return"number"!=typeof t?this.value()|
 |0:100*t},r.prototype.identify=function(){var t=this.json();return t.traits=this.traits(),new c(t,this.opts)},e.exports=r},{"./facade":78,"./identify":80,"./utils":86,"is-email":61,"obj-case":72}],86:[function(t,e,n){"use strict";n.inherit=t("inherits"),n.clone=t("@ndhoule/clone"),n.type=t("type-component")},{"@ndhoule/clone":3,inherits:60,"type-component":92}],87:[function(t,e,n){e.exports=function(t,e){return e||(e={}),t.toLowerCase().replace(e.replace||/[^a-z0-9]/g," ").replace(/^ +| +$/g,"").replace(/ +/g,e.separator||"-")}},{}],88:[function(t,e,n){(function(e,r){function o(t,e){this._id=t,this._clearFn=e}var i=t("process/browser.js").nextTick,a=Function.prototype.apply,s=Array.prototype.slice,c={},u=0;n.setTimeout=function(){return new o(a.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new o(a.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(t){t.close()},o.prototype.unref=o.prototype.ref=function(){},o
 .prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},n.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},n._unrefActive=n.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n.setImmediate="function"==typeof e?e:function(t){var e=u++,r=!(arguments.length<2)&&s.call(arguments,1);return c[e]=!0,i(function(){c[e]&&(r?t.apply(null,r):t.call(null),n.clearImmediate(e))}),e},n.clearImmediate="function"==typeof r?r:function(t){delete c[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":73,timers:88}],89:[function(t,e,n){function r(t){switch({}.toString.call(t)){case"[object Object]":return s(t);case"[object Function]":return t;case"[object String]":return a(t);case"[object RegExp]":return i(t);default:return o(t)}}function o(t){return function(e){re
 turn t===e}}function i(t){return function(e){return t.test(e)}}function a(t){return/^ *\W+/.test(t)?new Function("_","return _ "+t):new Function("_","return "+c(t))}function s(t){var e={};for(var n in t)e[n]="string"==typeof t[n]?o(t[n]):r(t[n]);return function(t){if("object"!=typeof t)return!1;for(var n in e){if(!(n in t))return!1;if(!e[n](t[n]))return!1}return!0}}function c(t){var e=p(t);if(!e.length)return"_."+t;var n,r,o;for(r=0;r<e.length;r++)o=e[r],n="_."+o,n="('function' == typeof "+n+" ? "+n+"() : "+n+")",t=u(o,t,n);return t}function u(t,e,n){return e.replace(new RegExp("(\\.)?"+t,"g"),function(t,e){return e?t:n})}var p;try{p=t("props")}catch(e){p=t("component-props")}e.exports=r},{"component-props":50,props:50}],90:[function(t,e,n){function r(t){return a.test(t)?t.toLowerCase():s.test(t)?(o(t)||t).toLowerCase():i(t).toLowerCase()}function o(t){return t.replace(c,function(t,e){return e?" "+e:""})}function i(t){return t.replace(u,function(t,e,n){return e+" "+n.toLowerCase().s
 plit("").join(" ")})}e.exports=r;var a=/\s/,s=/[\W_]/,c=/[\W_]+(.|$)/g,u=/(.)([A-Z]+)/g},{}],91:[function(t,e,n){function r(t){return t.replace(/^\s*|\s*$/g,"")}n=e.exports=r,n.left=function(t){return t.replace(/^\s*/,"")},n.right=function(t){return t.replace(/\s*$/,"")}},{}],92:[function(t,e,n){var r=Object.prototype.toString;e.exports=function(t){switch(r.call(t)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array"}return null===t?"null":void 0===t?"undefined":t===Object(t)?"object":typeof t}},{}],93:[function(t,e,n){function r(t){t=t.replace(/\r\n/g,"\n");for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e+=String.fromCharCode(r):r>127&&r<2048?(e+=String.fromCharCode(r>>6|192),e+=String.fromCharCode(63&r|128)):(e+=String.fromCharCode(r>>12|224),e+=String.fromCharCode(r>>6&63|128),e+=String.fromCharCode(63&r|128))}return e}e.exports=r}
 ,{}],94:[function(t,e,n){(function(t){var n,r=t.crypto||t.msCrypto;if(r&&r.getRandomValues){var o=new Uint8Array(16);n=function(){return r.getRandomValues(o),o}}if(!n){var i=new Array(16);n=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],95:[function(t,e,n){function r(t,e,n){var r=e&&n||0,o=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){o<16&&(e[r+o++]=u[t])});o<16;)e[r+o++]=0;return e}function o(t,e){var n=e||0,r=c;return r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]}function i(t,e,n){var r=e&&n||0,i=e||[];t=t||{};var a=void 0!==t.clockseq?t.clockseq:d,s=void 0!==t.msecs?t.msecs:(new Date).getTime(),c=void 0!==t.nsecs?t.nsecs:y+1,u=s-h+(c-y)/1e4;if(u
 <0&&void 0===t.clockseq&&(a=a+1&16383),(u<0||s>h)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");h=s,y=c,d=a,s+=122192928e5;var p=(1e4*(268435455&s)+c)%4294967296;i[r++]=p>>>24&255,i[r++]=p>>>16&255,i[r++]=p>>>8&255,i[r++]=255&p;var l=s/4294967296*1e4&268435455;i[r++]=l>>>8&255,i[r++]=255&l,i[r++]=l>>>24&15|16,i[r++]=l>>>16&255,i[r++]=a>>>8|128,i[r++]=255&a;for(var g=t.node||f,m=0;m<6;m++)i[r+m]=g[m];return e||o(i)}function a(t,e,n){var r=e&&n||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null),t=t||{};var i=t.random||(t.rng||s)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e)for(var a=0;a<16;a++)e[r+a]=i[a];return e||o(i)}for(var s=t("./rng"),c=[],u={},p=0;p<256;p++)c[p]=(p+256).toString(16).substr(1),u[c[p]]=p;var l=s(),f=[1|l[0],l[1],l[2],l[3],l[4],l[5]],d=16383&(l[6]<<8|l[7]),h=0,y=0,g=a;g.v1=i,g.v4=a,g.parse=r,g.unparse=o,e.exports=g},{"./rng":94}],96:[function(t,e,n){e.exports={name:"unomi-analytics",version:"1.0.2",desc
 ription:"The Apache Unomi analytics.js integration.",main:"src/index.js",keywords:["unomi","analytics.js","apache"],author:"Apache Software Foundation",license:"Apache-2.0",scripts:{build:"yarn browserify && yarn replace && yarn minify",browserify:"browserify src/index.js -p [ browserify-header --file src/license.js ] -s unomiTracker  > dist/unomi-tracker.js",replace:"replace-in-file 'analytics.require = require' '//analytics.require = require' dist/unomi-tracker.js",minify:"uglifyjs -c -m --comments '/@license/' -o dist/unomi-tracker.min.js -- dist/unomi-tracker.js","snippet:minify":"uglifyjs -c -m -o snippet.min.js -- snippet.js",clean:"rimraf *.log dist/unomi-tracker.js dist/unomi-tracker.min.js","clean:all":"yarn clean && rimraf node_modules"},dependencies:{"@segment/analytics.js-core":"^3.7.2","@segment/analytics.js-integration":"^2.1.1"},devDependencies:{"@segment/eslint-config":"^3.1.1",browserify:"^13.0.1","browserify-header":"^0.9.4",eslint:"^2.9.0","eslint-plugin-mocha":"^
 2.2.0","eslint-plugin-require-path-exists":"^1.1.5","replace-in-file":"^3.4.2",rimraf:"^2.6.2","uglify-js":"^2.6.4",watchify:"^3.11.0",yarn:"^1.9.4"}}},{}],97:[function(t,e,n){"use strict";var r=t("@segment/analytics.js-integration"),o=e.exports=r("Apache Unomi").assumesPageview().readyOnLoad().global("cxs").option("scope","systemscope").option("url","http://localhost:8181").option("timeoutInMilliseconds",1500).option("sessionCookieName","unomiSessionId").option("sessionId");o.prototype.initialize=function(e){var n=this;if(this.analytics.on("invoke",function(t){var e=t.action(),r="on"+t.action();n.debug("%s %o",e,t),n[r]&&n[r](t)}),!navigator.cookieEnabled)return void this.executeFallback();if(window.digitalData||(window.digitalData={scope:this.options.scope}),e){var r=e.json().properties,o=window.digitalData.page;o||(o=window.digitalData.page={pageInfo:{}}),this.fillPageData(o,r),window.digitalData.events||(window.digitalData.events=[]),window.digitalData.events.push(this.buildEven
 t("view",this.buildPage(o),this.buildSource(this.options.scope,"site")))}if(this.options.sessionId)this.sessionId=this.options.sessionId;else{var i=t("component-cookie");this.sessionId=i(this.options.sessionCookieName),this.sessionId&&""!==this.sessionId||(this.sessionId=this.generateGuid(),i(this.options.sessionCookieName,this.sessionId))}this.loadContext()},o.prototype.loaded=function(){return!!window.cxs},o.prototype.onpage=function(t){console.log("onpage"),console.log(t);var e={pageInfo:{}};this.fillPageData(e,t.json().properties),console.log(e),this.collectEvent(this.buildEvent("view",this.buildPage(e),this.buildSource(this.options.scope,"site")))},o.prototype.fillPageData=function(t,e){t.attributes=[],t.consentTypes=[],t.pageInfo.pageName=t.pageInfo.pageName||e.title,t.pageInfo.pageID=t.pageInfo.pageID||e.path,t.pageInfo.pagePath=t.pageInfo.pagePath||e.path,t.pageInfo.destinationURL=t.pageInfo.destinationURL||e.url,t.pageInfo.referringURL=t.pageInfo.referringURL||e.referrer},o
 .prototype.onidentify=function(t){console.log("onidentify"),console.log(t)},o.prototype.ontrack=function(t){console.log("ontrack"),console.log(t)},o.prototype.loadContext=function(t,e){var n={requiredProfileProperties:["j:nodename"],source:this.buildPage(window.digitalData.page)};t||(n.events=window.digitalData.events),window.digitalData.personalizationCallback&&(n.personalizations=window.digitalData.personalizationCallback.map(function(t){return t.personalization})),n.sessionId=this.sessionId;var r=this.options.url+"/context.json";e&&(r+="?invalidateSession=true&invalidateProfile=true");var o=this,i=function(t){if(window.cxs=JSON.parse(t.responseText),o.ready(),window.digitalData.loadCallbacks&&window.digitalData.loadCallbacks.length>0){if(console.info("[UNOMI] Found context server load callbacks, calling now..."),window.digitalData.loadCallbacks)for(var e=0;e<window.digitalData.loadCallbacks.length;e++)window.digitalData.loadCallbacks[e](digitalData);if(window.digitalData.personal
 izationCallback)for(var e=0;e<window.digitalData.personalizationCallback.length;e++)window.digitalData.personalizationCallback[e].callback(cxs.personalizations[window.digitalData.personalizationCallback[e].personalization.id])}};this.ajax({url:r,type:"POST",async:!0,contentType:"text/plain;charset=UTF-8",jsonData:n,dataType:"application/json",invalidate:e,success:i,error:this.executeFallback}),console.info("[UNOMI] context loading...")},o.prototype.buildEvent=function(t,e,n){var r={eventType:t,scope:window.digitalData.scope};return e&&(r.target=e),n&&(r.source=n),r},o.prototype.buildFormEvent=function(t){return this.buildEvent("form",this.buildTarget(t,"form"),this.buildSourcePage())},o.prototype.buildTargetPage=function(){return this.buildTarget(window.digitalData.page.pageInfo.pageID,"page",window.digitalData.page)},o.prototype.buildPage=function(t){return this.buildSource(t.pageInfo.pageID,"page",t)},o.prototype.buildTarget=function(t,e,n){return this.buildObject(t,e,n)},o.protot
 ype.buildSource=function(t,e,n){return this.buildObject(t,e,n)},o.prototype.collectEvent=function(t,e,n){this.collectEvents({events:[t]},e,n)},o.prototype.collectEvents=function(t,e,n){t.sessionId=this.sessionId;var r=JSON.stringify(t);this.ajax({url:this.options.url+"/eventcollector",type:"POST",async:!0,contentType:"text/plain;charset=UTF-8",data:r,dataType:"application/json",success:e,error:n})},o.prototype.registerEvent=function(t){window.digitalData?window.cxs?console.error("[UNOMI] already loaded, too late..."):(window.digitalData.events=window.digitalData.events||[],window.digitalData.events.push(t)):(window.digitalData={},window.digitalData.events=window.digitalData.events||[],window.digitalData.events.push(t))},o.prototype.registerCallback=function(t){window.digitalData?window.cxs?(console.info("[UNOMI] digitalData object loaded, calling on load callback immediately and registering update callback..."),t&&t(window.digitalData)):(console.info("[UNOMI] digitalData object pres
 ent but not loaded, registering load callback..."),t&&(window.digitalData.loadCallbacks=window.digitalData.loadCallbacks||[],window.digitalData.loadCallbacks.push(t))):(console.info("[UNOMI] No digital data object found, creating and registering update callback..."),window.digitalData={},t&&(window.digitalData.loadCallbacks=[],window.digitalData.loadCallbacks.push(t)))},o.prototype.generateGuid=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},o.prototype.buildObject=function(t,e,n){var r={scope:window.digitalData.scope,itemId:t,itemType:e};return n&&(r.properties=n),r},o.prototype.ajax=function(t){var e=new XMLHttpRequest;"withCredentials"in e?(e.open(t.type,t.url,t.async),e.withCredentials=!0):"undefined"!=typeof XDomainRequest&&(e=new XDomainRequest,e.open(t.type,t.url)),t.contentType&&e.setRequestHeader("Content-Type",t.contentType),t.dataType&&e.setRequestHeader("Accept",t.dataTyp
 e),t.responseType&&(e.responseType=t.responseType);var n=!1;-1!==this.options.timeoutInMilliseconds&&setTimeout(function(){n||(console.error("[UNOMI] XML request timeout, url: "+t.url),n=!0,t.error&&t.error(e))},this.options.timeoutInMilliseconds),e.onreadystatechange=function(){n||4===e.readyState&&(200===e.status||204===e.status||304===e.status?null!=e.responseText&&(n=!0,t.success&&t.success(e)):(n=!0,t.error&&t.error(e),console.error("[UNOMI] XML request error: "+e.statusText+" ("+e.status+")")))},t.jsonData?e.send(JSON.stringify(t.jsonData)):t.data?e.send(t.data):e.send()},o.prototype.executeFallback=function(){console.warn("[UNOMI] execute fallback"),window.cxs={};for(var t in window.digitalData.loadCallbacks)window.digitalData.loadCallbacks[t]();if(window.digitalData.personalizationCallback)for(var e=0;e<window.digitalData.personalizationCallback.length;e++)window.digitalData.personalizationCallback[e].callback([window.digitalData.personalizationCallback[e].personalization.st
 rategyOptions.fallback])}},{"@segment/analytics.js-integration":28,"component-cookie":45}],98:[function(t,e,n){var r=t("@segment/analytics.js-core"),o=t("./integrations");e.exports=n=r,n.VERSION=t("../package.json").version;for(var i in o)r.use(o[i])},{"../package.json":96,"./integrations":99,"@segment/analytics.js-core":19}],99:[function(t,e,n){"use strict";e.exports={"apache-unomi":t("./analytics.js-integration-apache-unomi")}},{"./analytics.js-integration-apache-unomi":97}]},{},[98])(98)});
\ No newline at end of file
+r.prototype.checkoutId=function(){return this.proxy("properties.checkout_id")||this.proxy("properties.checkoutId")},r.prototype.paymentId=function(){return this.proxy("properties.payment_id")||this.proxy("properties.paymentId")},r.prototype.couponId=function(){return this.proxy("properties.coupon_id")||this.proxy("properties.couponId")},r.prototype.wishlistId=function(){return this.proxy("properties.wishlist_id")||this.proxy("properties.wishlistId")},r.prototype.reviewId=function(){return this.proxy("properties.review_id")||this.proxy("properties.reviewId")},r.prototype.orderId=function(){return this.proxy("properties.id")||this.proxy("properties.order_id")||this.proxy("properties.orderId")},r.prototype.sku=s.proxy("properties.sku"),r.prototype.tax=s.proxy("properties.tax"),r.prototype.name=s.proxy("properties.name"),r.prototype.price=s.proxy("properties.price"),r.prototype.total=s.proxy("properties.total"),r.prototype.repeat=s.proxy("properties.repeat"),r.prototype.coupon=s.proxy("
 properties.coupon"),r.prototype.shipping=s.proxy("properties.shipping"),r.prototype.discount=s.proxy("properties.discount"),r.prototype.shippingMethod=function(){return this.proxy("properties.shipping_method")||this.proxy("properties.shippingMethod")},r.prototype.paymentMethod=function(){return this.proxy("properties.payment_method")||this.proxy("properties.paymentMethod")},r.prototype.description=s.proxy("properties.description"),r.prototype.plan=s.proxy("properties.plan"),r.prototype.subtotal=function(){var t=p(this.properties(),"subtotal"),e=this.total()||this.revenue();if(t)return t;if(!e)return 0;if(this.total()){var n=this.tax();n&&(e-=n),n=this.shipping(),n&&(e-=n),n=this.discount(),n&&(e+=n)}return e},r.prototype.products=function(){var t=this.properties(),e=p(t,"products");return"array"===a(e)?e:[]},r.prototype.quantity=function(){return(this.obj.properties||{}).quantity||1},r.prototype.currency=function(){return(this.obj.properties||{}).currency||"USD"},r.prototype.referre
 r=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")},r.prototype.query=s.proxy("options.query"),r.prototype.properties=function(t){var e=this.field("properties")||{};t=t||{};for(var n in t){var r=null==this[n]?this.proxy("properties."+n):this[n]();null!=r&&(e[t[n]]=r,delete e[n])}return e},r.prototype.username=function(){return this.proxy("traits.username")||this.proxy("properties.username")||this.userId()||this.sessionId()},r.prototype.email=function(){var t=this.proxy("traits.email")||this.proxy("properties.email")||this.proxy("options.traits.email");if(t)return t;var e=this.userId();return u(e)?e:void 0},r.prototype.revenue=function(){var t=this.proxy("properties.revenue"),e=this.event(),n=/^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i;return!t&&e&&e.match(n)&&(t=this.proxy("properties.total")),o(t)},r.prototype.cents=function(){var t=this.revenue();return"number"!=typeof t?this.value()|
 |0:100*t},r.prototype.identify=function(){var t=this.json();return t.traits=this.traits(),new c(t,this.opts)},e.exports=r},{"./facade":78,"./identify":80,"./utils":86,"is-email":61,"obj-case":72}],86:[function(t,e,n){"use strict";n.inherit=t("inherits"),n.clone=t("@ndhoule/clone"),n.type=t("type-component")},{"@ndhoule/clone":3,inherits:60,"type-component":92}],87:[function(t,e,n){e.exports=function(t,e){return e||(e={}),t.toLowerCase().replace(e.replace||/[^a-z0-9]/g," ").replace(/^ +| +$/g,"").replace(/ +/g,e.separator||"-")}},{}],88:[function(t,e,n){(function(e,r){function o(t,e){this._id=t,this._clearFn=e}var i=t("process/browser.js").nextTick,a=Function.prototype.apply,s=Array.prototype.slice,c={},u=0;n.setTimeout=function(){return new o(a.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new o(a.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(t){t.close()},o.prototype.unref=o.prototype.ref=function(){},o
 .prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},n.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},n._unrefActive=n.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n.setImmediate="function"==typeof e?e:function(t){var e=u++,r=!(arguments.length<2)&&s.call(arguments,1);return c[e]=!0,i(function(){c[e]&&(r?t.apply(null,r):t.call(null),n.clearImmediate(e))}),e},n.clearImmediate="function"==typeof r?r:function(t){delete c[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":73,timers:88}],89:[function(t,e,n){function r(t){switch({}.toString.call(t)){case"[object Object]":return s(t);case"[object Function]":return t;case"[object String]":return a(t);case"[object RegExp]":return i(t);default:return o(t)}}function o(t){return function(e){re
 turn t===e}}function i(t){return function(e){return t.test(e)}}function a(t){return/^ *\W+/.test(t)?new Function("_","return _ "+t):new Function("_","return "+c(t))}function s(t){var e={};for(var n in t)e[n]="string"==typeof t[n]?o(t[n]):r(t[n]);return function(t){if("object"!=typeof t)return!1;for(var n in e){if(!(n in t))return!1;if(!e[n](t[n]))return!1}return!0}}function c(t){var e=p(t);if(!e.length)return"_."+t;var n,r,o;for(r=0;r<e.length;r++)o=e[r],n="_."+o,n="('function' == typeof "+n+" ? "+n+"() : "+n+")",t=u(o,t,n);return t}function u(t,e,n){return e.replace(new RegExp("(\\.)?"+t,"g"),function(t,e){return e?t:n})}var p;try{p=t("props")}catch(e){p=t("component-props")}e.exports=r},{"component-props":50,props:50}],90:[function(t,e,n){function r(t){return a.test(t)?t.toLowerCase():s.test(t)?(o(t)||t).toLowerCase():i(t).toLowerCase()}function o(t){return t.replace(c,function(t,e){return e?" "+e:""})}function i(t){return t.replace(u,function(t,e,n){return e+" "+n.toLowerCase().s
 plit("").join(" ")})}e.exports=r;var a=/\s/,s=/[\W_]/,c=/[\W_]+(.|$)/g,u=/(.)([A-Z]+)/g},{}],91:[function(t,e,n){function r(t){return t.replace(/^\s*|\s*$/g,"")}n=e.exports=r,n.left=function(t){return t.replace(/^\s*/,"")},n.right=function(t){return t.replace(/\s*$/,"")}},{}],92:[function(t,e,n){var r=Object.prototype.toString;e.exports=function(t){switch(r.call(t)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array"}return null===t?"null":void 0===t?"undefined":t===Object(t)?"object":typeof t}},{}],93:[function(t,e,n){function r(t){t=t.replace(/\r\n/g,"\n");for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e+=String.fromCharCode(r):r>127&&r<2048?(e+=String.fromCharCode(r>>6|192),e+=String.fromCharCode(63&r|128)):(e+=String.fromCharCode(r>>12|224),e+=String.fromCharCode(r>>6&63|128),e+=String.fromCharCode(63&r|128))}return e}e.exports=r}
 ,{}],94:[function(t,e,n){(function(t){var n,r=t.crypto||t.msCrypto;if(r&&r.getRandomValues){var o=new Uint8Array(16);n=function(){return r.getRandomValues(o),o}}if(!n){var i=new Array(16);n=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),i[e]=t>>>((3&e)<<3)&255;return i}}e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],95:[function(t,e,n){function r(t,e,n){var r=e&&n||0,o=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){o<16&&(e[r+o++]=u[t])});o<16;)e[r+o++]=0;return e}function o(t,e){var n=e||0,r=c;return r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+"-"+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]+r[t[n++]]}function i(t,e,n){var r=e&&n||0,i=e||[];t=t||{};var a=void 0!==t.clockseq?t.clockseq:d,s=void 0!==t.msecs?t.msecs:(new Date).getTime(),c=void 0!==t.nsecs?t.nsecs:y+1,u=s-h+(c-y)/1e4;if(u
 <0&&void 0===t.clockseq&&(a=a+1&16383),(u<0||s>h)&&void 0===t.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");h=s,y=c,d=a,s+=122192928e5;var p=(1e4*(268435455&s)+c)%4294967296;i[r++]=p>>>24&255,i[r++]=p>>>16&255,i[r++]=p>>>8&255,i[r++]=255&p;var l=s/4294967296*1e4&268435455;i[r++]=l>>>8&255,i[r++]=255&l,i[r++]=l>>>24&15|16,i[r++]=l>>>16&255,i[r++]=a>>>8|128,i[r++]=255&a;for(var g=t.node||f,m=0;m<6;m++)i[r+m]=g[m];return e||o(i)}function a(t,e,n){var r=e&&n||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null),t=t||{};var i=t.random||(t.rng||s)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e)for(var a=0;a<16;a++)e[r+a]=i[a];return e||o(i)}for(var s=t("./rng"),c=[],u={},p=0;p<256;p++)c[p]=(p+256).toString(16).substr(1),u[c[p]]=p;var l=s(),f=[1|l[0],l[1],l[2],l[3],l[4],l[5]],d=16383&(l[6]<<8|l[7]),h=0,y=0,g=a;g.v1=i,g.v4=a,g.parse=r,g.unparse=o,e.exports=g},{"./rng":94}],96:[function(t,e,n){e.exports={name:"unomi-analytics",version:"1.0.3",desc
 ription:"The Apache Unomi analytics.js integration.",main:"dist/unomi-tracker.js",keywords:["unomi","analytics.js","apache"],author:"Apache Software Foundation",license:"Apache-2.0",scripts:{build:"yarn browserify && yarn replace && yarn minify",browserify:"browserify src/index.js -p [ browserify-header --file src/license.js ] -s unomiTracker -o dist/unomi-tracker.js",replace:"replace-in-file 'analytics.require = require' '//analytics.require = require' dist/unomi-tracker.js",minify:"uglifyjs -c -m --comments '/@license/' -o dist/unomi-tracker.min.js -- dist/unomi-tracker.js","snippet:minify":"uglifyjs -c -m -o snippet.min.js -- snippet.js",clean:"rimraf *.log dist/unomi-tracker.js dist/unomi-tracker.min.js","clean:all":"yarn clean && rimraf node_modules"},dependencies:{"@segment/analytics.js-core":"^3.7.2","@segment/analytics.js-integration":"^2.1.1"},devDependencies:{"@segment/eslint-config":"^3.1.1",browserify:"^13.0.1","browserify-header":"^0.9.4",eslint:"^2.9.0","eslint-plugin-
 mocha":"^2.2.0","eslint-plugin-require-path-exists":"^1.1.5","replace-in-file":"^3.4.2",rimraf:"^2.6.2","uglify-js":"^2.6.4",yarn:"^1.9.4"}}},{}],97:[function(t,e,n){"use strict";var r=t("@segment/analytics.js-integration"),o=e.exports=r("Apache Unomi").assumesPageview().readyOnLoad().global("cxs").option("scope","systemscope").option("url","http://localhost:8181").option("timeoutInMilliseconds",1500).option("sessionCookieName","unomiSessionId").option("sessionId");o.prototype.initialize=function(e){var n=this;if(this.analytics.on("invoke",function(t){var e=t.action(),r="on"+t.action();n.debug("%s %o",e,t),n[r]&&n[r](t)}),this.analytics.personalize=function(t,e){this.emit("invoke",{action:function(){return"personalize"},personalization:t,callback:e})},!navigator.cookieEnabled)return void this.executeFallback();if(window.digitalData=window.digitalData||{scope:this.options.scope},e){var r=e.json().properties,o=window.digitalData.page;o||(o=window.digitalData.page={pageInfo:{}}),this.f
 illPageData(o,r),window.digitalData.events=window.digitalData.events||[],window.digitalData.events.push(this.buildEvent("view",this.buildPage(o),this.buildSource(this.options.scope,"site")))}if(this.options.sessionId)this.sessionId=this.options.sessionId;else{var i=t("component-cookie");this.sessionId=i(this.options.sessionCookieName),this.sessionId&&""!==this.sessionId||(this.sessionId=this.generateGuid(),i(this.options.sessionCookieName,this.sessionId))}setTimeout(this.loadContext.bind(this),0)},o.prototype.loaded=function(){return!!window.cxs},o.prototype.onpage=function(t){console.log("onpage"),console.log(t);var e={pageInfo:{}};this.fillPageData(e,t.json().properties),console.log(e),this.collectEvent(this.buildEvent("view",this.buildPage(e),this.buildSource(this.options.scope,"site")))},o.prototype.fillPageData=function(t,e){t.attributes=[],t.consentTypes=[],t.pageInfo.pageName=t.pageInfo.pageName||e.title,t.pageInfo.pageID=t.pageInfo.pageID||e.path,t.pageInfo.pagePath=t.pageIn
 fo.pagePath||e.path,t.pageInfo.destinationURL=t.pageInfo.destinationURL||e.url,t.pageInfo.referringURL=t.pageInfo.referringURL||e.referrer},o.prototype.onidentify=function(t){console.log("onidentify"),console.log(t)},o.prototype.ontrack=function(t){console.log("ontrack"),console.log(t)},o.prototype.loadContext=function(t,e){var n={requiredProfileProperties:["j:nodename"],source:this.buildPage(window.digitalData.page)};t||(n.events=window.digitalData.events),window.digitalData.personalizationCallback&&(n.personalizations=window.digitalData.personalizationCallback.map(function(t){return t.personalization})),n.sessionId=this.sessionId;var r=this.options.url+"/context.json";e&&(r+="?invalidateSession=true&invalidateProfile=true");var o=this,i=function(t){if(window.cxs=JSON.parse(t.responseText),o.ready(),window.digitalData.loadCallbacks){console.info("[UNOMI] Found context server load callbacks, calling now...");for(var e=0;e<window.digitalData.loadCallbacks.length;e++)window.digitalDat
 a.loadCallbacks[e](digitalData)}if(window.digitalData.personalizationCallback){console.info("[UNOMI] Found context server personalization, calling now...");for(var e=0;e<window.digitalData.personalizationCallback.length;e++)window.digitalData.personalizationCallback[e].callback(cxs.personalizations[window.digitalData.personalizationCallback[e].personalization.id])}};this.ajax({url:r,type:"POST",async:!0,contentType:"text/plain;charset=UTF-8",jsonData:n,dataType:"application/json",invalidate:e,success:i,error:this.executeFallback}),console.info("[UNOMI] context loading...")},o.prototype.onpersonalize=function(t){window.cxs&&console.error("[WEM] already loaded, too late..."),window.digitalData=window.digitalData||{scope:this.options.scope},window.digitalData.personalizationCallback=window.digitalData.personalizationCallback||[],window.digitalData.personalizationCallback.push({personalization:t.personalization,callback:t.callback})},o.prototype.buildEvent=function(t,e,n){var r={eventTy
 pe:t,scope:window.digitalData.scope};return e&&(r.target=e),n&&(r.source=n),r},o.prototype.buildFormEvent=function(t){return this.buildEvent("form",this.buildTarget(t,"form"),this.buildSourcePage())},o.prototype.buildTargetPage=function(){return this.buildTarget(window.digitalData.page.pageInfo.pageID,"page",window.digitalData.page)},o.prototype.buildPage=function(t){return this.buildSource(t.pageInfo.pageID,"page",t)},o.prototype.buildTarget=function(t,e,n){return this.buildObject(t,e,n)},o.prototype.buildSource=function(t,e,n){return this.buildObject(t,e,n)},o.prototype.collectEvent=function(t,e,n){this.collectEvents({events:[t]},e,n)},o.prototype.collectEvents=function(t,e,n){t.sessionId=this.sessionId;var r=JSON.stringify(t);this.ajax({url:this.options.url+"/eventcollector",type:"POST",async:!0,contentType:"text/plain;charset=UTF-8",data:r,dataType:"application/json",success:e,error:n})},o.prototype.registerEvent=function(t){window.digitalData?window.cxs?console.error("[UNOMI] a
 lready loaded, too late..."):(window.digitalData.events=window.digitalData.events||[],window.digitalData.events.push(t)):(window.digitalData={},window.digitalData.events=window.digitalData.events||[],window.digitalData.events.push(t))},o.prototype.registerCallback=function(t){window.digitalData?window.cxs?(console.info("[UNOMI] digitalData object loaded, calling on load callback immediately and registering update callback..."),t&&t(window.digitalData)):(console.info("[UNOMI] digitalData object present but not loaded, registering load callback..."),t&&(window.digitalData.loadCallbacks=window.digitalData.loadCallbacks||[],window.digitalData.loadCallbacks.push(t))):(console.info("[UNOMI] No digital data object found, creating and registering update callback..."),window.digitalData={},t&&(window.digitalData.loadCallbacks=[],window.digitalData.loadCallbacks.push(t)))},o.prototype.generateGuid=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}ret
 urn t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},o.prototype.buildObject=function(t,e,n){var r={scope:window.digitalData.scope,itemId:t,itemType:e};return n&&(r.properties=n),r},o.prototype.ajax=function(t){var e=new XMLHttpRequest;"withCredentials"in e?(e.open(t.type,t.url,t.async),e.withCredentials=!0):"undefined"!=typeof XDomainRequest&&(e=new XDomainRequest,e.open(t.type,t.url)),t.contentType&&e.setRequestHeader("Content-Type",t.contentType),t.dataType&&e.setRequestHeader("Accept",t.dataType),t.responseType&&(e.responseType=t.responseType);var n=!1;-1!==this.options.timeoutInMilliseconds&&setTimeout(function(){n||(console.error("[UNOMI] XML request timeout, url: "+t.url),n=!0,t.error&&t.error(e))},this.options.timeoutInMilliseconds),e.onreadystatechange=function(){n||4===e.readyState&&(200===e.status||204===e.status||304===e.status?null!=e.responseText&&(n=!0,t.success&&t.success(e)):(n=!0,t.error&&t.error(e),console.error("[UNOMI] XML request error: "+e.statusText+" ("+e.st
 atus+")")))},t.jsonData?e.send(JSON.stringify(t.jsonData)):t.data?e.send(t.data):e.send()},o.prototype.executeFallback=function(){console.warn("[UNOMI] execute fallback"),window.cxs={};for(var t in window.digitalData.loadCallbacks)window.digitalData.loadCallbacks[t]();if(window.digitalData.personalizationCallback)for(var e=0;e<window.digitalData.personalizationCallback.length;e++)window.digitalData.personalizationCallback[e].callback([window.digitalData.personalizationCallback[e].personalization.strategyOptions.fallback])}},{"@segment/analytics.js-integration":28,"component-cookie":45}],98:[function(t,e,n){var r=t("@segment/analytics.js-core"),o=t("./integrations");e.exports=n=r,n.VERSION=t("../package.json").version;for(var i in o)r.use(o[i])},{"../package.json":96,"./integrations":99,"@segment/analytics.js-core":19}],99:[function(t,e,n){"use strict";e.exports={"apache-unomi":t("./analytics.js-integration-apache-unomi")}},{"./analytics.js-integration-apache-unomi":97}]},{},[98])(98
 )});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b4b0560b/extensions/web-tracker/javascript/package.json
----------------------------------------------------------------------
diff --git a/extensions/web-tracker/javascript/package.json b/extensions/web-tracker/javascript/package.json
index 5fd2081..342de5b 100644
--- a/extensions/web-tracker/javascript/package.json
+++ b/extensions/web-tracker/javascript/package.json
@@ -12,7 +12,7 @@
   "license": "Apache-2.0",
   "scripts": {
     "build": "yarn browserify && yarn replace && yarn minify",
-    "browserify": "browserify src/index.js -p [ browserify-header --file src/license.js ] -s unomiTracker  > dist/unomi-tracker.js",
+    "browserify": "browserify src/index.js -p [ browserify-header --file src/license.js ] -s unomiTracker -o dist/unomi-tracker.js",
     "replace": "replace-in-file 'analytics.require = require' '//analytics.require = require' dist/unomi-tracker.js",
     "minify": "uglifyjs -c -m --comments '/@license/' -o dist/unomi-tracker.min.js -- dist/unomi-tracker.js",
     "snippet:minify": "uglifyjs -c -m -o snippet.min.js -- snippet.js",
@@ -33,7 +33,6 @@
     "replace-in-file": "^3.4.2",
     "rimraf": "^2.6.2",
     "uglify-js": "^2.6.4",
-    "watchify": "^3.11.0",
     "yarn": "^1.9.4"
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b4b0560b/extensions/web-tracker/javascript/snippet.js
----------------------------------------------------------------------
diff --git a/extensions/web-tracker/javascript/snippet.js b/extensions/web-tracker/javascript/snippet.js
index 784ccd9..4084684 100644
--- a/extensions/web-tracker/javascript/snippet.js
+++ b/extensions/web-tracker/javascript/snippet.js
@@ -18,7 +18,7 @@ window.unomiTracker || (window.unomiTracker = {});
 (function () {
     var unomiTracker_queue = [];
 
-    var methods = ['trackSubmit', 'trackClick', 'trackLink', 'trackForm', 'initialize', 'pageview', 'identify', 'reset', 'group', 'track', 'ready', 'alias', 'debug', 'page', 'once', 'off', 'on'];
+    var methods = ['trackSubmit', 'trackClick', 'trackLink', 'trackForm', 'initialize', 'pageview', 'identify', 'reset', 'group', 'track', 'ready', 'alias', 'debug', 'page', 'once', 'off', 'on', 'personalize'];
 
     var factory = function (method) {
         return function () {
@@ -43,7 +43,7 @@ window.unomiTracker || (window.unomiTracker = {});
         script.type = 'text/javascript';
         script.async = true;
         // TODO we might want to add a check on the url to see if it ends with / or not
-        script.src = option.url + '/tracker/javascript/unomi-tracker.min.js';
+        script.src = option.url + '/tracker/unomi-tracker.min.js';
 
         if (script.addEventListener) {
             script.addEventListener('load', function (e) {

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b4b0560b/extensions/web-tracker/javascript/snippet.min.js
----------------------------------------------------------------------
diff --git a/extensions/web-tracker/javascript/snippet.min.js b/extensions/web-tracker/javascript/snippet.min.js
index bd05fb2..ac64638 100644
--- a/extensions/web-tracker/javascript/snippet.min.js
+++ b/extensions/web-tracker/javascript/snippet.min.js
@@ -1 +1 @@
-window.unomiTracker||(window.unomiTracker={}),function(){for(var e=[],r=["trackSubmit","trackClick","trackLink","trackForm","initialize","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on"],n=0;n<r.length;n++){var t=r[n];window.unomiTracker[t]=function(r){return function(){var n=Array.prototype.slice.call(arguments);return n.unshift(r),e.push(n),window.unomiTracker}}(t)}unomiTracker.load=function(e,r){var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=r.url+"/tracker/javascript/unomi-tracker.min.js",n.addEventListener?n.addEventListener("load",function(r){"function"==typeof e&&e(r)},!1):n.onreadystatechange=function(){"complete"!=this.readyState&&"loaded"!=this.readyState||e(window.event)};var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(n,t)},unomiTracker.load(function(r){for(unomiTracker.initialize({"Apache Unomi":r});e.length>0;){var n=e.shift(),t=n.shift();unomiTracker[t]&&unomiTra
 cker[t].apply(unomiTracker,n)}},unomiOption),unomiTracker.page()}();
\ No newline at end of file
+window.unomiTracker||(window.unomiTracker={}),function(){for(var e=[],r=["trackSubmit","trackClick","trackLink","trackForm","initialize","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","personalize"],n=0;n<r.length;n++){var t=r[n];window.unomiTracker[t]=function(r){return function(){var n=Array.prototype.slice.call(arguments);return n.unshift(r),e.push(n),window.unomiTracker}}(t)}unomiTracker.load=function(e,r){var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=r.url+"/tracker/unomi-tracker.min.js",n.addEventListener?n.addEventListener("load",function(r){"function"==typeof e&&e(r)},!1):n.onreadystatechange=function(){"complete"!=this.readyState&&"loaded"!=this.readyState||e(window.event)};var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(n,t)},unomiTracker.load(function(r){for(unomiTracker.initialize({"Apache Unomi":r});e.length>0;){var n=e.shift(),t=n.shift();unomiTracker[t]&&unomi
 Tracker[t].apply(unomiTracker,n)}},unomiOption),unomiTracker.page()}();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/b4b0560b/extensions/web-tracker/javascript/src/analytics.js-integration-apache-unomi.js
----------------------------------------------------------------------
diff --git a/extensions/web-tracker/javascript/src/analytics.js-integration-apache-unomi.js b/extensions/web-tracker/javascript/src/analytics.js-integration-apache-unomi.js
index b1b17c5..56f976c 100644
--- a/extensions/web-tracker/javascript/src/analytics.js-integration-apache-unomi.js
+++ b/extensions/web-tracker/javascript/src/analytics.js-integration-apache-unomi.js
@@ -42,6 +42,10 @@ Unomi.prototype.initialize = function(page) {
         if (self[listener]) self[listener](msg);
     });
 
+    this.analytics.personalize = function(personalization, callback) {
+        this.emit('invoke', {action:function() {return "personalize"}, personalization:personalization, callback:callback});
+    };
+
     // Standard to check if cookies are enabled in this browser
     if (!navigator.cookieEnabled) {
         this.executeFallback();
@@ -49,11 +53,9 @@ Unomi.prototype.initialize = function(page) {
     }
 
     // digitalData come from a standard so we can keep the logic around it which can allow complex website to load more complex data
-    if (!window.digitalData) {
-        window.digitalData = {
-            scope: this.options.scope
-        };
-    }
+    window.digitalData = window.digitalData || {
+        scope: this.options.scope
+    };
 
     if (page) {
         var props = page.json().properties;
@@ -62,9 +64,7 @@ Unomi.prototype.initialize = function(page) {
             unomiPage = window.digitalData.page = { pageInfo:{} }
         }
         this.fillPageData(unomiPage, props);
-        if (!window.digitalData.events) {
-            window.digitalData.events = []
-        }
+        window.digitalData.events = window.digitalData.events || [];
         window.digitalData.events.push(this.buildEvent('view', this.buildPage(unomiPage), this.buildSource(this.options.scope, 'site')))
     }
 
@@ -81,8 +81,7 @@ Unomi.prototype.initialize = function(page) {
         this.sessionId = this.options.sessionId;
     }
 
-
-    this.loadContext();
+    setTimeout(this.loadContext.bind(this), 0);
 };
 
 /**
@@ -186,17 +185,16 @@ Unomi.prototype.loadContext = function (skipEvents, invalidate) {
 
         self.ready();
 
-        if (window.digitalData.loadCallbacks && window.digitalData.loadCallbacks.length > 0) {
+        if (window.digitalData.loadCallbacks) {
             console.info('[UNOMI] Found context server load callbacks, calling now...');
-            if (window.digitalData.loadCallbacks) {
-                for (var i = 0; i < window.digitalData.loadCallbacks.length; i++) {
-                    window.digitalData.loadCallbacks[i](digitalData);
-                }
+            for (var i = 0; i < window.digitalData.loadCallbacks.length; i++) {
+                window.digitalData.loadCallbacks[i](digitalData);
             }
-            if (window.digitalData.personalizationCallback) {
-                for (var i = 0; i < window.digitalData.personalizationCallback.length; i++) {
-                    window.digitalData.personalizationCallback[i].callback(cxs.personalizations[window.digitalData.personalizationCallback[i].personalization.id]);
-                }
+        }
+        if (window.digitalData.personalizationCallback) {
+            console.info('[UNOMI] Found context server personalization, calling now...');
+            for (var i = 0; i < window.digitalData.personalizationCallback.length; i++) {
+                window.digitalData.personalizationCallback[i].callback(cxs.personalizations[window.digitalData.personalizationCallback[i].personalization.id]);
             }
         }
     };
@@ -216,6 +214,17 @@ Unomi.prototype.loadContext = function (skipEvents, invalidate) {
     console.info('[UNOMI] context loading...');
 };
 
+Unomi.prototype.onpersonalize = function (msg) {
+    if (window.cxs) {
+        console.error('[WEM] already loaded, too late...');
+    }
+    window.digitalData = window.digitalData || {
+        scope: this.options.scope
+    };
+    window.digitalData.personalizationCallback = window.digitalData.personalizationCallback || [];
+    window.digitalData.personalizationCallback.push({personalization: msg.personalization, callback: msg.callback});
+},
+
 /**
  * This function return the basic structure for an event, it must be adapted to your need
  *