This is an automated email from the ASF dual-hosted git repository.

jkevan pushed a commit to branch refacto-control-group-usage
in repository https://gitbox.apache.org/repos/asf/unomi-tracker.git


The following commit(s) were added to refs/heads/refacto-control-group-usage by 
this push:
     new 054957d  UNOMI-713: update control group usage by using new 
personalizationResults
054957d is described below

commit 054957da079bb56d79081c735c2b6388ba1baffa
Author: Kevan <[email protected]>
AuthorDate: Thu Nov 10 16:54:31 2022 +0100

    UNOMI-713: update control group usage by using new personalizationResults
---
 dist/apache-unomi-tracker.cjs.js     | 13 ++++++++++---
 dist/apache-unomi-tracker.cjs.js.map |  2 +-
 dist/apache-unomi-tracker.esm.js     | 13 ++++++++++---
 dist/apache-unomi-tracker.esm.js.map |  2 +-
 dist/apache-unomi-tracker.umd.js     | 13 ++++++++++---
 dist/apache-unomi-tracker.umd.js.map |  2 +-
 6 files changed, 33 insertions(+), 12 deletions(-)

diff --git a/dist/apache-unomi-tracker.cjs.js b/dist/apache-unomi-tracker.cjs.js
index 622fbe8..6518064 100644
--- a/dist/apache-unomi-tracker.cjs.js
+++ b/dist/apache-unomi-tracker.cjs.js
@@ -189,10 +189,10 @@ var newTracker = function newTracker() {
     registerPersonalizationObject: function 
registerPersonalizationObject(personalization, variants, ajax, resultCallback) {
       var target = personalization.id;
 
-      wem._registerPersonalizationCallback(personalization, function (result, 
advancedResult) {
+      wem._registerPersonalizationCallback(personalization, function (result, 
additionalResultInfos) {
         var selectedFilter = null;
         var successfulFilters = [];
-        var inControlGroup = advancedResult && 
advancedResult.additionalResultInfos && 
advancedResult.additionalResultInfos.inControlGroup; // In case of control 
group Unomi is not resolving any strategy or fallback for us. So we have to do 
the fallback here.
+        var inControlGroup = additionalResultInfos && 
additionalResultInfos.inControlGroup; // In case of control group Unomi is not 
resolving any strategy or fallback for us. So we have to do the fallback here.
 
         if (inControlGroup && personalization.strategyOptions && 
personalization.strategyOptions.fallback) {
           selectedFilter = variants[personalization.strategyOptions.fallback];
@@ -1277,7 +1277,14 @@ var newTracker = function newTracker() {
 
         if (wem.digitalData.personalizationCallback) {
           for (var j = 0; j < wem.digitalData.personalizationCallback.length; 
j++) {
-            
wem.digitalData.personalizationCallback[j].callback(wem.cxs.personalizations[wem.digitalData.personalizationCallback[j].personalization.id],
 wem.cxs.personalizationResults ? 
wem.cxs.personalizationResults[wem.digitalData.personalizationCallback[j].personalization.id]
 : undefined);
+            if (wem.cxs.personalizationResults) {
+              // Since Unomi 2.1.0 personalization results are available with 
more infos
+              var personalizationResult = 
wem.cxs.personalizations[wem.digitalData.personalizationCallback[j].personalization.id];
+              
wem.digitalData.personalizationCallback[j].callback(personalizationResult.contentIds,
 personalizationResult.additionalResultInfos);
+            } else {
+              // probably a version older than Unomi 2.1.0, fallback to old 
personalization results
+              
wem.digitalData.personalizationCallback[j].callback(wem.cxs.personalizations[wem.digitalData.personalizationCallback[j].personalization.id]);
+            }
           }
         }
       }
diff --git a/dist/apache-unomi-tracker.cjs.js.map 
b/dist/apache-unomi-tracker.cjs.js.map
index feca98e..9c1c4d4 100644
--- a/dist/apache-unomi-tracker.cjs.js.map
+++ b/dist/apache-unomi-tracker.cjs.js.map
@@ -1 +1 @@
-{"version":3,"file":"apache-unomi-tracker.cjs.js","sources":["../src/apache-unomi-tracker.js","../src/index.js"],"sourcesContent":["/*\n
 * Licensed to the Apache Software Foundation (ASF) under one or more\n * 
contributor license agreements.  See the NOTICE file distributed with\n * this 
work for additional information regarding copyright ownership.\n * The ASF 
licenses this file to You under the Apache License, Version 2.0\n * (the 
\"License\"); you may not use this file except in compl [...]
\ No newline at end of file
+{"version":3,"file":"apache-unomi-tracker.cjs.js","sources":["../src/apache-unomi-tracker.js","../src/index.js"],"sourcesContent":["/*\n
 * Licensed to the Apache Software Foundation (ASF) under one or more\n * 
contributor license agreements.  See the NOTICE file distributed with\n * this 
work for additional information regarding copyright ownership.\n * The ASF 
licenses this file to You under the Apache License, Version 2.0\n * (the 
\"License\"); you may not use this file except in compl [...]
\ No newline at end of file
diff --git a/dist/apache-unomi-tracker.esm.js b/dist/apache-unomi-tracker.esm.js
index c906518..f8ae5a3 100644
--- a/dist/apache-unomi-tracker.esm.js
+++ b/dist/apache-unomi-tracker.esm.js
@@ -181,10 +181,10 @@ var newTracker = function newTracker() {
     registerPersonalizationObject: function 
registerPersonalizationObject(personalization, variants, ajax, resultCallback) {
       var target = personalization.id;
 
-      wem._registerPersonalizationCallback(personalization, function (result, 
advancedResult) {
+      wem._registerPersonalizationCallback(personalization, function (result, 
additionalResultInfos) {
         var selectedFilter = null;
         var successfulFilters = [];
-        var inControlGroup = advancedResult && 
advancedResult.additionalResultInfos && 
advancedResult.additionalResultInfos.inControlGroup; // In case of control 
group Unomi is not resolving any strategy or fallback for us. So we have to do 
the fallback here.
+        var inControlGroup = additionalResultInfos && 
additionalResultInfos.inControlGroup; // In case of control group Unomi is not 
resolving any strategy or fallback for us. So we have to do the fallback here.
 
         if (inControlGroup && personalization.strategyOptions && 
personalization.strategyOptions.fallback) {
           selectedFilter = variants[personalization.strategyOptions.fallback];
@@ -1269,7 +1269,14 @@ var newTracker = function newTracker() {
 
         if (wem.digitalData.personalizationCallback) {
           for (var j = 0; j < wem.digitalData.personalizationCallback.length; 
j++) {
-            
wem.digitalData.personalizationCallback[j].callback(wem.cxs.personalizations[wem.digitalData.personalizationCallback[j].personalization.id],
 wem.cxs.personalizationResults ? 
wem.cxs.personalizationResults[wem.digitalData.personalizationCallback[j].personalization.id]
 : undefined);
+            if (wem.cxs.personalizationResults) {
+              // Since Unomi 2.1.0 personalization results are available with 
more infos
+              var personalizationResult = 
wem.cxs.personalizations[wem.digitalData.personalizationCallback[j].personalization.id];
+              
wem.digitalData.personalizationCallback[j].callback(personalizationResult.contentIds,
 personalizationResult.additionalResultInfos);
+            } else {
+              // probably a version older than Unomi 2.1.0, fallback to old 
personalization results
+              
wem.digitalData.personalizationCallback[j].callback(wem.cxs.personalizations[wem.digitalData.personalizationCallback[j].personalization.id]);
+            }
           }
         }
       }
diff --git a/dist/apache-unomi-tracker.esm.js.map 
b/dist/apache-unomi-tracker.esm.js.map
index 1b3942e..ee8a89c 100644
--- a/dist/apache-unomi-tracker.esm.js.map
+++ b/dist/apache-unomi-tracker.esm.js.map
@@ -1 +1 @@
-{"version":3,"file":"apache-unomi-tracker.esm.js","sources":["../src/apache-unomi-tracker.js","../src/index.js"],"sourcesContent":["/*\n
 * Licensed to the Apache Software Foundation (ASF) under one or more\n * 
contributor license agreements.  See the NOTICE file distributed with\n * this 
work for additional information regarding copyright ownership.\n * The ASF 
licenses this file to You under the Apache License, Version 2.0\n * (the 
\"License\"); you may not use this file except in compl [...]
\ No newline at end of file
+{"version":3,"file":"apache-unomi-tracker.esm.js","sources":["../src/apache-unomi-tracker.js","../src/index.js"],"sourcesContent":["/*\n
 * Licensed to the Apache Software Foundation (ASF) under one or more\n * 
contributor license agreements.  See the NOTICE file distributed with\n * this 
work for additional information regarding copyright ownership.\n * The ASF 
licenses this file to You under the Apache License, Version 2.0\n * (the 
\"License\"); you may not use this file except in compl [...]
\ No newline at end of file
diff --git a/dist/apache-unomi-tracker.umd.js b/dist/apache-unomi-tracker.umd.js
index 8cd8be1..ddb457f 100644
--- a/dist/apache-unomi-tracker.umd.js
+++ b/dist/apache-unomi-tracker.umd.js
@@ -1836,10 +1836,10 @@
       registerPersonalizationObject: function 
registerPersonalizationObject(personalization, variants, ajax, resultCallback) {
         var target = personalization.id;
 
-        wem._registerPersonalizationCallback(personalization, function 
(result, advancedResult) {
+        wem._registerPersonalizationCallback(personalization, function 
(result, additionalResultInfos) {
           var selectedFilter = null;
           var successfulFilters = [];
-          var inControlGroup = advancedResult && 
advancedResult.additionalResultInfos && 
advancedResult.additionalResultInfos.inControlGroup; // In case of control 
group Unomi is not resolving any strategy or fallback for us. So we have to do 
the fallback here.
+          var inControlGroup = additionalResultInfos && 
additionalResultInfos.inControlGroup; // In case of control group Unomi is not 
resolving any strategy or fallback for us. So we have to do the fallback here.
 
           if (inControlGroup && personalization.strategyOptions && 
personalization.strategyOptions.fallback) {
             selectedFilter = 
variants[personalization.strategyOptions.fallback];
@@ -2924,7 +2924,14 @@
 
           if (wem.digitalData.personalizationCallback) {
             for (var j = 0; j < 
wem.digitalData.personalizationCallback.length; j++) {
-              
wem.digitalData.personalizationCallback[j].callback(wem.cxs.personalizations[wem.digitalData.personalizationCallback[j].personalization.id],
 wem.cxs.personalizationResults ? 
wem.cxs.personalizationResults[wem.digitalData.personalizationCallback[j].personalization.id]
 : undefined);
+              if (wem.cxs.personalizationResults) {
+                // Since Unomi 2.1.0 personalization results are available 
with more infos
+                var personalizationResult = 
wem.cxs.personalizations[wem.digitalData.personalizationCallback[j].personalization.id];
+                
wem.digitalData.personalizationCallback[j].callback(personalizationResult.contentIds,
 personalizationResult.additionalResultInfos);
+              } else {
+                // probably a version older than Unomi 2.1.0, fallback to old 
personalization results
+                
wem.digitalData.personalizationCallback[j].callback(wem.cxs.personalizations[wem.digitalData.personalizationCallback[j].personalization.id]);
+              }
             }
           }
         }
diff --git a/dist/apache-unomi-tracker.umd.js.map 
b/dist/apache-unomi-tracker.umd.js.map
index 035fdac..7b99cc0 100644
--- a/dist/apache-unomi-tracker.umd.js.map
+++ b/dist/apache-unomi-tracker.umd.js.map
@@ -1 +1 @@
-{"version":3,"file":"apache-unomi-tracker.umd.js","sources":["../node_modules/@babel/runtime/helpers/esm/typeof.js","../node_modules/es6-crawler-detect/src/lib/crawler/provider.js","../node_modules/es6-crawler-detect/src/lib/crawler/crawlers.js","../node_modules/es6-crawler-detect/src/lib/crawler/exclusions.js","../node_modules/es6-crawler-detect/src/lib/crawler/headers.js","../node_modules/es6-crawler-detect/src/lib/crawler.js","../node_modules/es6-crawler-detect/src/index.js","../src/a
 [...]
\ No newline at end of file
+{"version":3,"file":"apache-unomi-tracker.umd.js","sources":["../node_modules/@babel/runtime/helpers/esm/typeof.js","../node_modules/es6-crawler-detect/src/lib/crawler/provider.js","../node_modules/es6-crawler-detect/src/lib/crawler/crawlers.js","../node_modules/es6-crawler-detect/src/lib/crawler/exclusions.js","../node_modules/es6-crawler-detect/src/lib/crawler/headers.js","../node_modules/es6-crawler-detect/src/lib/crawler.js","../node_modules/es6-crawler-detect/src/index.js","../src/a
 [...]
\ No newline at end of file

Reply via email to