@blotoutio/providers-google-ads-clicks-sdk 1.28.1 → 1.30.0
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.cjs.js +35 -3
- package/index.js +35 -3
- package/index.mjs +35 -3
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -42,6 +42,12 @@ const upsert = (map, key, update, createDefault) => {
|
|
|
42
42
|
return map.set(key, update(currentValue));
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
const addDaysToDate = (date, days) => {
|
|
46
|
+
const newDate = new Date(date);
|
|
47
|
+
newDate.setDate(newDate.getDate() + days);
|
|
48
|
+
return newDate;
|
|
49
|
+
};
|
|
50
|
+
|
|
45
51
|
const expand = (str) => str.split(',').flatMap((entry) => {
|
|
46
52
|
if (!entry.includes('-')) {
|
|
47
53
|
return entry;
|
|
@@ -610,14 +616,14 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
|
|
|
610
616
|
!getCookieValue('_gcl_au')) {
|
|
611
617
|
return {
|
|
612
618
|
isFired: false,
|
|
613
|
-
sdkVersion: "1.
|
|
619
|
+
sdkVersion: "1.30.0" ,
|
|
614
620
|
};
|
|
615
621
|
}
|
|
616
622
|
const conversionLabel = getConversionLabel(eventName, manifestVariables);
|
|
617
623
|
if (!conversionLabel) {
|
|
618
624
|
return {
|
|
619
625
|
isFired: false,
|
|
620
|
-
sdkVersion: "1.
|
|
626
|
+
sdkVersion: "1.30.0" ,
|
|
621
627
|
};
|
|
622
628
|
}
|
|
623
629
|
if (manifestVariables['enhancedConversionsSetting'] === 'gtag' &&
|
|
@@ -634,7 +640,7 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
|
|
|
634
640
|
});
|
|
635
641
|
return {
|
|
636
642
|
isFired: true,
|
|
637
|
-
sdkVersion: "1.
|
|
643
|
+
sdkVersion: "1.30.0" ,
|
|
638
644
|
};
|
|
639
645
|
};
|
|
640
646
|
|
|
@@ -655,12 +661,38 @@ const consent = ({ consentData, variables }) => {
|
|
|
655
661
|
});
|
|
656
662
|
};
|
|
657
663
|
|
|
664
|
+
const user = ({ data, manifestVariables, destination }) => {
|
|
665
|
+
const queryKey = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['queryKey'];
|
|
666
|
+
if (!queryKey) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
try {
|
|
670
|
+
const queryValue = data[`googleAdsClicks::${queryKey}`];
|
|
671
|
+
const cookieName = `_gcl_aw`;
|
|
672
|
+
if (!queryValue) {
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
const expires = addDaysToDate(new Date(), 90);
|
|
676
|
+
const timestamp = ((Date.now() + 500) / 1000) | 0;
|
|
677
|
+
const cookieValue = `GCL.${timestamp}.${queryValue}`;
|
|
678
|
+
let domain = '';
|
|
679
|
+
if (destination) {
|
|
680
|
+
domain = `domain=${destination.slice(destination.indexOf('.'))}`;
|
|
681
|
+
}
|
|
682
|
+
document.cookie = `${cookieName}=${cookieValue};expires=${expires.toUTCString()};path=/;${domain}`;
|
|
683
|
+
}
|
|
684
|
+
catch {
|
|
685
|
+
// do nothing
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
|
|
658
689
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
659
690
|
const data = {
|
|
660
691
|
name: packageName,
|
|
661
692
|
init,
|
|
662
693
|
tag,
|
|
663
694
|
consent,
|
|
695
|
+
user,
|
|
664
696
|
};
|
|
665
697
|
try {
|
|
666
698
|
if (window) {
|
package/index.js
CHANGED
|
@@ -43,6 +43,12 @@ var ProvidersGoogleAdsClicksSdk = (function () {
|
|
|
43
43
|
return map.set(key, update(currentValue));
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
const addDaysToDate = (date, days) => {
|
|
47
|
+
const newDate = new Date(date);
|
|
48
|
+
newDate.setDate(newDate.getDate() + days);
|
|
49
|
+
return newDate;
|
|
50
|
+
};
|
|
51
|
+
|
|
46
52
|
const expand = (str) => str.split(',').flatMap((entry) => {
|
|
47
53
|
if (!entry.includes('-')) {
|
|
48
54
|
return entry;
|
|
@@ -611,14 +617,14 @@ var ProvidersGoogleAdsClicksSdk = (function () {
|
|
|
611
617
|
!getCookieValue('_gcl_au')) {
|
|
612
618
|
return {
|
|
613
619
|
isFired: false,
|
|
614
|
-
sdkVersion: "1.
|
|
620
|
+
sdkVersion: "1.30.0" ,
|
|
615
621
|
};
|
|
616
622
|
}
|
|
617
623
|
const conversionLabel = getConversionLabel(eventName, manifestVariables);
|
|
618
624
|
if (!conversionLabel) {
|
|
619
625
|
return {
|
|
620
626
|
isFired: false,
|
|
621
|
-
sdkVersion: "1.
|
|
627
|
+
sdkVersion: "1.30.0" ,
|
|
622
628
|
};
|
|
623
629
|
}
|
|
624
630
|
if (manifestVariables['enhancedConversionsSetting'] === 'gtag' &&
|
|
@@ -635,7 +641,7 @@ var ProvidersGoogleAdsClicksSdk = (function () {
|
|
|
635
641
|
});
|
|
636
642
|
return {
|
|
637
643
|
isFired: true,
|
|
638
|
-
sdkVersion: "1.
|
|
644
|
+
sdkVersion: "1.30.0" ,
|
|
639
645
|
};
|
|
640
646
|
};
|
|
641
647
|
|
|
@@ -656,12 +662,38 @@ var ProvidersGoogleAdsClicksSdk = (function () {
|
|
|
656
662
|
});
|
|
657
663
|
};
|
|
658
664
|
|
|
665
|
+
const user = ({ data, manifestVariables, destination }) => {
|
|
666
|
+
const queryKey = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['queryKey'];
|
|
667
|
+
if (!queryKey) {
|
|
668
|
+
return;
|
|
669
|
+
}
|
|
670
|
+
try {
|
|
671
|
+
const queryValue = data[`googleAdsClicks::${queryKey}`];
|
|
672
|
+
const cookieName = `_gcl_aw`;
|
|
673
|
+
if (!queryValue) {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
const expires = addDaysToDate(new Date(), 90);
|
|
677
|
+
const timestamp = ((Date.now() + 500) / 1000) | 0;
|
|
678
|
+
const cookieValue = `GCL.${timestamp}.${queryValue}`;
|
|
679
|
+
let domain = '';
|
|
680
|
+
if (destination) {
|
|
681
|
+
domain = `domain=${destination.slice(destination.indexOf('.'))}`;
|
|
682
|
+
}
|
|
683
|
+
document.cookie = `${cookieName}=${cookieValue};expires=${expires.toUTCString()};path=/;${domain}`;
|
|
684
|
+
}
|
|
685
|
+
catch {
|
|
686
|
+
// do nothing
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
|
|
659
690
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
660
691
|
const data = {
|
|
661
692
|
name: packageName,
|
|
662
693
|
init,
|
|
663
694
|
tag,
|
|
664
695
|
consent,
|
|
696
|
+
user,
|
|
665
697
|
};
|
|
666
698
|
try {
|
|
667
699
|
if (window) {
|
package/index.mjs
CHANGED
|
@@ -40,6 +40,12 @@ const upsert = (map, key, update, createDefault) => {
|
|
|
40
40
|
return map.set(key, update(currentValue));
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
const addDaysToDate = (date, days) => {
|
|
44
|
+
const newDate = new Date(date);
|
|
45
|
+
newDate.setDate(newDate.getDate() + days);
|
|
46
|
+
return newDate;
|
|
47
|
+
};
|
|
48
|
+
|
|
43
49
|
const expand = (str) => str.split(',').flatMap((entry) => {
|
|
44
50
|
if (!entry.includes('-')) {
|
|
45
51
|
return entry;
|
|
@@ -608,14 +614,14 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
|
|
|
608
614
|
!getCookieValue('_gcl_au')) {
|
|
609
615
|
return {
|
|
610
616
|
isFired: false,
|
|
611
|
-
sdkVersion: "1.
|
|
617
|
+
sdkVersion: "1.30.0" ,
|
|
612
618
|
};
|
|
613
619
|
}
|
|
614
620
|
const conversionLabel = getConversionLabel(eventName, manifestVariables);
|
|
615
621
|
if (!conversionLabel) {
|
|
616
622
|
return {
|
|
617
623
|
isFired: false,
|
|
618
|
-
sdkVersion: "1.
|
|
624
|
+
sdkVersion: "1.30.0" ,
|
|
619
625
|
};
|
|
620
626
|
}
|
|
621
627
|
if (manifestVariables['enhancedConversionsSetting'] === 'gtag' &&
|
|
@@ -632,7 +638,7 @@ const tag = ({ data, eventName, manifestVariables, destination, }) => {
|
|
|
632
638
|
});
|
|
633
639
|
return {
|
|
634
640
|
isFired: true,
|
|
635
|
-
sdkVersion: "1.
|
|
641
|
+
sdkVersion: "1.30.0" ,
|
|
636
642
|
};
|
|
637
643
|
};
|
|
638
644
|
|
|
@@ -653,12 +659,38 @@ const consent = ({ consentData, variables }) => {
|
|
|
653
659
|
});
|
|
654
660
|
};
|
|
655
661
|
|
|
662
|
+
const user = ({ data, manifestVariables, destination }) => {
|
|
663
|
+
const queryKey = manifestVariables === null || manifestVariables === void 0 ? void 0 : manifestVariables['queryKey'];
|
|
664
|
+
if (!queryKey) {
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
try {
|
|
668
|
+
const queryValue = data[`googleAdsClicks::${queryKey}`];
|
|
669
|
+
const cookieName = `_gcl_aw`;
|
|
670
|
+
if (!queryValue) {
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
const expires = addDaysToDate(new Date(), 90);
|
|
674
|
+
const timestamp = ((Date.now() + 500) / 1000) | 0;
|
|
675
|
+
const cookieValue = `GCL.${timestamp}.${queryValue}`;
|
|
676
|
+
let domain = '';
|
|
677
|
+
if (destination) {
|
|
678
|
+
domain = `domain=${destination.slice(destination.indexOf('.'))}`;
|
|
679
|
+
}
|
|
680
|
+
document.cookie = `${cookieName}=${cookieValue};expires=${expires.toUTCString()};path=/;${domain}`;
|
|
681
|
+
}
|
|
682
|
+
catch {
|
|
683
|
+
// do nothing
|
|
684
|
+
}
|
|
685
|
+
};
|
|
686
|
+
|
|
656
687
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
657
688
|
const data = {
|
|
658
689
|
name: packageName,
|
|
659
690
|
init,
|
|
660
691
|
tag,
|
|
661
692
|
consent,
|
|
693
|
+
user,
|
|
662
694
|
};
|
|
663
695
|
try {
|
|
664
696
|
if (window) {
|