@blotoutio/edgetag-sdk-browser 0.23.0 → 0.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +35 -24
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -513,7 +513,7 @@
|
|
|
513
513
|
referrer: getReferrer(),
|
|
514
514
|
search: getSearch(),
|
|
515
515
|
locale: getLocale(),
|
|
516
|
-
sdkVersion: "0.
|
|
516
|
+
sdkVersion: "0.24.1" ,
|
|
517
517
|
...(payload || {}),
|
|
518
518
|
};
|
|
519
519
|
let storage = {};
|
|
@@ -582,8 +582,11 @@
|
|
|
582
582
|
};
|
|
583
583
|
|
|
584
584
|
const manifestVariables = {};
|
|
585
|
-
const addProviderVariable = (name, variables) => {
|
|
586
|
-
manifestVariables[name] =
|
|
585
|
+
const addProviderVariable = (name, variables, tagName) => {
|
|
586
|
+
manifestVariables[name] = {
|
|
587
|
+
...manifestVariables[name],
|
|
588
|
+
[tagName]: variables || {},
|
|
589
|
+
};
|
|
587
590
|
};
|
|
588
591
|
const getProviderVariables = (name) => {
|
|
589
592
|
if (!name) {
|
|
@@ -660,17 +663,19 @@
|
|
|
660
663
|
!allowProviderWithConsent(providers, pkg.name)) {
|
|
661
664
|
return;
|
|
662
665
|
}
|
|
663
|
-
const
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
666
|
+
const variables = getProviderVariables(pkg.name);
|
|
667
|
+
const result = {};
|
|
668
|
+
for (const [tagName, variableSet] of Object.entries(variables)) {
|
|
669
|
+
result[tagName] = pkg.tag({
|
|
670
|
+
userId,
|
|
671
|
+
eventName,
|
|
672
|
+
eventId,
|
|
673
|
+
data: JSON.parse(JSON.stringify(data)),
|
|
674
|
+
sendTag,
|
|
675
|
+
manifestVariables: variableSet,
|
|
676
|
+
});
|
|
673
677
|
}
|
|
678
|
+
providerData[pkg.name] = result;
|
|
674
679
|
});
|
|
675
680
|
}
|
|
676
681
|
sendTag({
|
|
@@ -699,11 +704,14 @@
|
|
|
699
704
|
!allowProviderWithConsent(providers, pkg.name)) {
|
|
700
705
|
return;
|
|
701
706
|
}
|
|
702
|
-
pkg.
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
+
const variables = getProviderVariables(pkg.name);
|
|
708
|
+
for (const variableSet of Object.values(variables)) {
|
|
709
|
+
pkg.user({
|
|
710
|
+
userId,
|
|
711
|
+
data,
|
|
712
|
+
manifestVariables: variableSet,
|
|
713
|
+
});
|
|
714
|
+
}
|
|
707
715
|
});
|
|
708
716
|
}
|
|
709
717
|
postRequest(getDataURL(), { data, providers }, options).catch(error);
|
|
@@ -808,7 +816,7 @@
|
|
|
808
816
|
const userId = handleGetUserId();
|
|
809
817
|
setAllowedProviders(manifest.map((provider) => provider.package));
|
|
810
818
|
manifest.forEach((provider) => {
|
|
811
|
-
addProviderVariable(provider.package, provider.variables);
|
|
819
|
+
addProviderVariable(provider.package, provider.variables, provider.tagName);
|
|
812
820
|
if (provider.rules) {
|
|
813
821
|
Object.entries(provider.rules).forEach(([name, recipe]) => {
|
|
814
822
|
switch (name) {
|
|
@@ -891,11 +899,14 @@
|
|
|
891
899
|
!allowProviderWithConsent(providers, pkg.name)) {
|
|
892
900
|
return;
|
|
893
901
|
}
|
|
894
|
-
pkg.
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
902
|
+
const variables = getProviderVariables(pkg.name);
|
|
903
|
+
for (const variableSet of Object.values(variables)) {
|
|
904
|
+
pkg.user({
|
|
905
|
+
userId,
|
|
906
|
+
data: { [key]: value },
|
|
907
|
+
manifestVariables: variableSet,
|
|
908
|
+
});
|
|
909
|
+
}
|
|
899
910
|
});
|
|
900
911
|
}
|
|
901
912
|
postRequest(getUserURL(), {
|