@blotoutio/providers-google-ads-clicks-sdk 0.49.0 → 0.50.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.cjs.js +26 -70
- package/index.js +26 -70
- package/index.mjs +26 -70
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -2,58 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const packageName = 'googleAdsClicks';
|
|
4
4
|
|
|
5
|
-
const getCookieValue = (key) => {
|
|
6
|
-
try {
|
|
7
|
-
if (!document || !document.cookie) {
|
|
8
|
-
return '';
|
|
9
|
-
}
|
|
10
|
-
const name = `${key}=`;
|
|
11
|
-
const decodedCookie = decodeURIComponent(document.cookie);
|
|
12
|
-
const ca = decodedCookie.split(';');
|
|
13
|
-
for (let i = 0; i < ca.length; i++) {
|
|
14
|
-
let c = ca[i];
|
|
15
|
-
while (c.charAt(0) === ' ') {
|
|
16
|
-
c = c.substring(1);
|
|
17
|
-
}
|
|
18
|
-
if (c.indexOf(name) === 0) {
|
|
19
|
-
return c.substring(name.length, c.length);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return '';
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
return '';
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
const setCookie = (key, value, options) => {
|
|
29
|
-
var _a;
|
|
30
|
-
try {
|
|
31
|
-
if (!document) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const extras = [`path=${(_a = options === null || options === void 0 ? void 0 : options.path) !== null && _a !== void 0 ? _a : '/'}`];
|
|
35
|
-
if (options === null || options === void 0 ? void 0 : options['maxAge']) {
|
|
36
|
-
extras.push(`max-age=${options['maxAge']}`);
|
|
37
|
-
}
|
|
38
|
-
if (options === null || options === void 0 ? void 0 : options.expires) {
|
|
39
|
-
extras.push(`expires=${options.expires}`);
|
|
40
|
-
}
|
|
41
|
-
if (options === null || options === void 0 ? void 0 : options.partitioned) {
|
|
42
|
-
extras.push('partitioned');
|
|
43
|
-
}
|
|
44
|
-
if (options === null || options === void 0 ? void 0 : options.samesite) {
|
|
45
|
-
extras.push(`samesite=${options.samesite}`);
|
|
46
|
-
}
|
|
47
|
-
if (options === null || options === void 0 ? void 0 : options.secure) {
|
|
48
|
-
extras.push('secure');
|
|
49
|
-
}
|
|
50
|
-
document.cookie = `${key}=${value};${extras.join(';')}`;
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
5
|
const upsert = (map, key, update, createDefault) => {
|
|
58
6
|
const currentValue = map.has(key)
|
|
59
7
|
? map.get(key)
|
|
@@ -96,7 +44,6 @@ new Set([
|
|
|
96
44
|
]);
|
|
97
45
|
|
|
98
46
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
99
|
-
let googleIntervalCheck = 0;
|
|
100
47
|
const initGAds = (ID, executionContext) => {
|
|
101
48
|
var _a;
|
|
102
49
|
window.dataLayer = window.dataLayer || [];
|
|
@@ -154,21 +101,6 @@ const init = ({ manifest, executionContext }) => {
|
|
|
154
101
|
send_page_view: false,
|
|
155
102
|
});
|
|
156
103
|
}
|
|
157
|
-
const isGAdsCookieCreated = getCookieValue('_gAds_loaded');
|
|
158
|
-
if (isGAdsCookieCreated !== '1') {
|
|
159
|
-
const interval = setInterval(() => {
|
|
160
|
-
const isGAdsLoaded = window &&
|
|
161
|
-
!!window.google_tag_manager &&
|
|
162
|
-
!!window.google_tag_manager[manifest.variables['tagId']];
|
|
163
|
-
setCookie('_gAds_loaded', isGAdsLoaded ? '1' : '0');
|
|
164
|
-
googleIntervalCheck++;
|
|
165
|
-
if ((window.google_tag_manager &&
|
|
166
|
-
!!window.google_tag_manager[manifest.variables['tagId']]) ||
|
|
167
|
-
googleIntervalCheck > 15) {
|
|
168
|
-
clearInterval(interval);
|
|
169
|
-
}
|
|
170
|
-
}, 1500);
|
|
171
|
-
}
|
|
172
104
|
};
|
|
173
105
|
|
|
174
106
|
const getConversionLabel = (eventName, manifestVariables) => {
|
|
@@ -221,14 +153,38 @@ const handleTag = ({ data, eventName, manifestVariables, }) => {
|
|
|
221
153
|
});
|
|
222
154
|
};
|
|
223
155
|
|
|
156
|
+
const getCookieValue = (key) => {
|
|
157
|
+
try {
|
|
158
|
+
if (!document || !document.cookie) {
|
|
159
|
+
return '';
|
|
160
|
+
}
|
|
161
|
+
const name = `${key}=`;
|
|
162
|
+
const decodedCookie = decodeURIComponent(document.cookie);
|
|
163
|
+
const ca = decodedCookie.split(';');
|
|
164
|
+
for (let i = 0; i < ca.length; i++) {
|
|
165
|
+
let c = ca[i];
|
|
166
|
+
while (c.charAt(0) === ' ') {
|
|
167
|
+
c = c.substring(1);
|
|
168
|
+
}
|
|
169
|
+
if (c.indexOf(name) === 0) {
|
|
170
|
+
return c.substring(name.length, c.length);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return '';
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
return '';
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
224
180
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
225
|
-
const isLoaded =
|
|
181
|
+
const isLoaded = window && window.gtag && !!getCookieValue('_gcl_au');
|
|
226
182
|
if (isLoaded) {
|
|
227
183
|
handleTag({ data, eventName, manifestVariables, eventId });
|
|
228
184
|
}
|
|
229
185
|
return {
|
|
230
186
|
loaded: isLoaded,
|
|
231
|
-
sdkVersion: "0.
|
|
187
|
+
sdkVersion: "0.50.1" ,
|
|
232
188
|
};
|
|
233
189
|
};
|
|
234
190
|
|
package/index.js
CHANGED
|
@@ -3,58 +3,6 @@ var ProvidersGoogleAdsClicksSdk = (function () {
|
|
|
3
3
|
|
|
4
4
|
const packageName = 'googleAdsClicks';
|
|
5
5
|
|
|
6
|
-
const getCookieValue = (key) => {
|
|
7
|
-
try {
|
|
8
|
-
if (!document || !document.cookie) {
|
|
9
|
-
return '';
|
|
10
|
-
}
|
|
11
|
-
const name = `${key}=`;
|
|
12
|
-
const decodedCookie = decodeURIComponent(document.cookie);
|
|
13
|
-
const ca = decodedCookie.split(';');
|
|
14
|
-
for (let i = 0; i < ca.length; i++) {
|
|
15
|
-
let c = ca[i];
|
|
16
|
-
while (c.charAt(0) === ' ') {
|
|
17
|
-
c = c.substring(1);
|
|
18
|
-
}
|
|
19
|
-
if (c.indexOf(name) === 0) {
|
|
20
|
-
return c.substring(name.length, c.length);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return '';
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
return '';
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
const setCookie = (key, value, options) => {
|
|
30
|
-
var _a;
|
|
31
|
-
try {
|
|
32
|
-
if (!document) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const extras = [`path=${(_a = options === null || options === void 0 ? void 0 : options.path) !== null && _a !== void 0 ? _a : '/'}`];
|
|
36
|
-
if (options === null || options === void 0 ? void 0 : options['maxAge']) {
|
|
37
|
-
extras.push(`max-age=${options['maxAge']}`);
|
|
38
|
-
}
|
|
39
|
-
if (options === null || options === void 0 ? void 0 : options.expires) {
|
|
40
|
-
extras.push(`expires=${options.expires}`);
|
|
41
|
-
}
|
|
42
|
-
if (options === null || options === void 0 ? void 0 : options.partitioned) {
|
|
43
|
-
extras.push('partitioned');
|
|
44
|
-
}
|
|
45
|
-
if (options === null || options === void 0 ? void 0 : options.samesite) {
|
|
46
|
-
extras.push(`samesite=${options.samesite}`);
|
|
47
|
-
}
|
|
48
|
-
if (options === null || options === void 0 ? void 0 : options.secure) {
|
|
49
|
-
extras.push('secure');
|
|
50
|
-
}
|
|
51
|
-
document.cookie = `${key}=${value};${extras.join(';')}`;
|
|
52
|
-
}
|
|
53
|
-
catch {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
6
|
const upsert = (map, key, update, createDefault) => {
|
|
59
7
|
const currentValue = map.has(key)
|
|
60
8
|
? map.get(key)
|
|
@@ -97,7 +45,6 @@ var ProvidersGoogleAdsClicksSdk = (function () {
|
|
|
97
45
|
]);
|
|
98
46
|
|
|
99
47
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
100
|
-
let googleIntervalCheck = 0;
|
|
101
48
|
const initGAds = (ID, executionContext) => {
|
|
102
49
|
var _a;
|
|
103
50
|
window.dataLayer = window.dataLayer || [];
|
|
@@ -155,21 +102,6 @@ var ProvidersGoogleAdsClicksSdk = (function () {
|
|
|
155
102
|
send_page_view: false,
|
|
156
103
|
});
|
|
157
104
|
}
|
|
158
|
-
const isGAdsCookieCreated = getCookieValue('_gAds_loaded');
|
|
159
|
-
if (isGAdsCookieCreated !== '1') {
|
|
160
|
-
const interval = setInterval(() => {
|
|
161
|
-
const isGAdsLoaded = window &&
|
|
162
|
-
!!window.google_tag_manager &&
|
|
163
|
-
!!window.google_tag_manager[manifest.variables['tagId']];
|
|
164
|
-
setCookie('_gAds_loaded', isGAdsLoaded ? '1' : '0');
|
|
165
|
-
googleIntervalCheck++;
|
|
166
|
-
if ((window.google_tag_manager &&
|
|
167
|
-
!!window.google_tag_manager[manifest.variables['tagId']]) ||
|
|
168
|
-
googleIntervalCheck > 15) {
|
|
169
|
-
clearInterval(interval);
|
|
170
|
-
}
|
|
171
|
-
}, 1500);
|
|
172
|
-
}
|
|
173
105
|
};
|
|
174
106
|
|
|
175
107
|
const getConversionLabel = (eventName, manifestVariables) => {
|
|
@@ -222,14 +154,38 @@ var ProvidersGoogleAdsClicksSdk = (function () {
|
|
|
222
154
|
});
|
|
223
155
|
};
|
|
224
156
|
|
|
157
|
+
const getCookieValue = (key) => {
|
|
158
|
+
try {
|
|
159
|
+
if (!document || !document.cookie) {
|
|
160
|
+
return '';
|
|
161
|
+
}
|
|
162
|
+
const name = `${key}=`;
|
|
163
|
+
const decodedCookie = decodeURIComponent(document.cookie);
|
|
164
|
+
const ca = decodedCookie.split(';');
|
|
165
|
+
for (let i = 0; i < ca.length; i++) {
|
|
166
|
+
let c = ca[i];
|
|
167
|
+
while (c.charAt(0) === ' ') {
|
|
168
|
+
c = c.substring(1);
|
|
169
|
+
}
|
|
170
|
+
if (c.indexOf(name) === 0) {
|
|
171
|
+
return c.substring(name.length, c.length);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return '';
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
return '';
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
225
181
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
226
|
-
const isLoaded =
|
|
182
|
+
const isLoaded = window && window.gtag && !!getCookieValue('_gcl_au');
|
|
227
183
|
if (isLoaded) {
|
|
228
184
|
handleTag({ data, eventName, manifestVariables, eventId });
|
|
229
185
|
}
|
|
230
186
|
return {
|
|
231
187
|
loaded: isLoaded,
|
|
232
|
-
sdkVersion: "0.
|
|
188
|
+
sdkVersion: "0.50.1" ,
|
|
233
189
|
};
|
|
234
190
|
};
|
|
235
191
|
|
package/index.mjs
CHANGED
|
@@ -1,57 +1,5 @@
|
|
|
1
1
|
const packageName = 'googleAdsClicks';
|
|
2
2
|
|
|
3
|
-
const getCookieValue = (key) => {
|
|
4
|
-
try {
|
|
5
|
-
if (!document || !document.cookie) {
|
|
6
|
-
return '';
|
|
7
|
-
}
|
|
8
|
-
const name = `${key}=`;
|
|
9
|
-
const decodedCookie = decodeURIComponent(document.cookie);
|
|
10
|
-
const ca = decodedCookie.split(';');
|
|
11
|
-
for (let i = 0; i < ca.length; i++) {
|
|
12
|
-
let c = ca[i];
|
|
13
|
-
while (c.charAt(0) === ' ') {
|
|
14
|
-
c = c.substring(1);
|
|
15
|
-
}
|
|
16
|
-
if (c.indexOf(name) === 0) {
|
|
17
|
-
return c.substring(name.length, c.length);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return '';
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return '';
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
const setCookie = (key, value, options) => {
|
|
27
|
-
var _a;
|
|
28
|
-
try {
|
|
29
|
-
if (!document) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const extras = [`path=${(_a = options === null || options === void 0 ? void 0 : options.path) !== null && _a !== void 0 ? _a : '/'}`];
|
|
33
|
-
if (options === null || options === void 0 ? void 0 : options['maxAge']) {
|
|
34
|
-
extras.push(`max-age=${options['maxAge']}`);
|
|
35
|
-
}
|
|
36
|
-
if (options === null || options === void 0 ? void 0 : options.expires) {
|
|
37
|
-
extras.push(`expires=${options.expires}`);
|
|
38
|
-
}
|
|
39
|
-
if (options === null || options === void 0 ? void 0 : options.partitioned) {
|
|
40
|
-
extras.push('partitioned');
|
|
41
|
-
}
|
|
42
|
-
if (options === null || options === void 0 ? void 0 : options.samesite) {
|
|
43
|
-
extras.push(`samesite=${options.samesite}`);
|
|
44
|
-
}
|
|
45
|
-
if (options === null || options === void 0 ? void 0 : options.secure) {
|
|
46
|
-
extras.push('secure');
|
|
47
|
-
}
|
|
48
|
-
document.cookie = `${key}=${value};${extras.join(';')}`;
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
3
|
const upsert = (map, key, update, createDefault) => {
|
|
56
4
|
const currentValue = map.has(key)
|
|
57
5
|
? map.get(key)
|
|
@@ -94,7 +42,6 @@ new Set([
|
|
|
94
42
|
]);
|
|
95
43
|
|
|
96
44
|
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
97
|
-
let googleIntervalCheck = 0;
|
|
98
45
|
const initGAds = (ID, executionContext) => {
|
|
99
46
|
var _a;
|
|
100
47
|
window.dataLayer = window.dataLayer || [];
|
|
@@ -152,21 +99,6 @@ const init = ({ manifest, executionContext }) => {
|
|
|
152
99
|
send_page_view: false,
|
|
153
100
|
});
|
|
154
101
|
}
|
|
155
|
-
const isGAdsCookieCreated = getCookieValue('_gAds_loaded');
|
|
156
|
-
if (isGAdsCookieCreated !== '1') {
|
|
157
|
-
const interval = setInterval(() => {
|
|
158
|
-
const isGAdsLoaded = window &&
|
|
159
|
-
!!window.google_tag_manager &&
|
|
160
|
-
!!window.google_tag_manager[manifest.variables['tagId']];
|
|
161
|
-
setCookie('_gAds_loaded', isGAdsLoaded ? '1' : '0');
|
|
162
|
-
googleIntervalCheck++;
|
|
163
|
-
if ((window.google_tag_manager &&
|
|
164
|
-
!!window.google_tag_manager[manifest.variables['tagId']]) ||
|
|
165
|
-
googleIntervalCheck > 15) {
|
|
166
|
-
clearInterval(interval);
|
|
167
|
-
}
|
|
168
|
-
}, 1500);
|
|
169
|
-
}
|
|
170
102
|
};
|
|
171
103
|
|
|
172
104
|
const getConversionLabel = (eventName, manifestVariables) => {
|
|
@@ -219,14 +151,38 @@ const handleTag = ({ data, eventName, manifestVariables, }) => {
|
|
|
219
151
|
});
|
|
220
152
|
};
|
|
221
153
|
|
|
154
|
+
const getCookieValue = (key) => {
|
|
155
|
+
try {
|
|
156
|
+
if (!document || !document.cookie) {
|
|
157
|
+
return '';
|
|
158
|
+
}
|
|
159
|
+
const name = `${key}=`;
|
|
160
|
+
const decodedCookie = decodeURIComponent(document.cookie);
|
|
161
|
+
const ca = decodedCookie.split(';');
|
|
162
|
+
for (let i = 0; i < ca.length; i++) {
|
|
163
|
+
let c = ca[i];
|
|
164
|
+
while (c.charAt(0) === ' ') {
|
|
165
|
+
c = c.substring(1);
|
|
166
|
+
}
|
|
167
|
+
if (c.indexOf(name) === 0) {
|
|
168
|
+
return c.substring(name.length, c.length);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return '';
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
return '';
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
222
178
|
const tag = ({ data, eventName, manifestVariables, eventId }) => {
|
|
223
|
-
const isLoaded =
|
|
179
|
+
const isLoaded = window && window.gtag && !!getCookieValue('_gcl_au');
|
|
224
180
|
if (isLoaded) {
|
|
225
181
|
handleTag({ data, eventName, manifestVariables, eventId });
|
|
226
182
|
}
|
|
227
183
|
return {
|
|
228
184
|
loaded: isLoaded,
|
|
229
|
-
sdkVersion: "0.
|
|
185
|
+
sdkVersion: "0.50.1" ,
|
|
230
186
|
};
|
|
231
187
|
};
|
|
232
188
|
|