mytart 0.2.1 → 0.2.3
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/dist/index.js +10 -10
- package/dist/index.mjs +10 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -104,21 +104,21 @@ var GoogleAnalyticsProvider = class extends BaseProvider {
|
|
|
104
104
|
}
|
|
105
105
|
injectGtagScript() {
|
|
106
106
|
return new Promise((resolve) => {
|
|
107
|
+
window.dataLayer = window.dataLayer || [];
|
|
108
|
+
window.gtag = window.gtag || function gtag(...args) {
|
|
109
|
+
window.dataLayer.push(args);
|
|
110
|
+
};
|
|
107
111
|
const script = document.createElement("script");
|
|
108
112
|
script.async = true;
|
|
109
113
|
script.src = `${GTAG_URL}?id=${this.config.measurementId}`;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
window.dataLayer.push(args);
|
|
114
|
+
script.onload = () => {
|
|
115
|
+
window.gtag("js", /* @__PURE__ */ new Date());
|
|
116
|
+
window.gtag("config", this.config.measurementId);
|
|
117
|
+
resolve();
|
|
115
118
|
};
|
|
116
|
-
window.gtag("js", /* @__PURE__ */ new Date());
|
|
117
|
-
window.gtag("config", this.config.measurementId, {
|
|
118
|
-
send_page_view: false
|
|
119
|
-
});
|
|
120
|
-
script.onload = () => resolve();
|
|
121
119
|
script.onerror = () => resolve();
|
|
120
|
+
const firstScript = document.getElementsByTagName("script")[0];
|
|
121
|
+
firstScript.parentNode?.insertBefore(script, firstScript);
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
buildGtagResult() {
|
package/dist/index.mjs
CHANGED
|
@@ -61,21 +61,21 @@ var GoogleAnalyticsProvider = class extends BaseProvider {
|
|
|
61
61
|
}
|
|
62
62
|
injectGtagScript() {
|
|
63
63
|
return new Promise((resolve) => {
|
|
64
|
+
window.dataLayer = window.dataLayer || [];
|
|
65
|
+
window.gtag = window.gtag || function gtag(...args) {
|
|
66
|
+
window.dataLayer.push(args);
|
|
67
|
+
};
|
|
64
68
|
const script = document.createElement("script");
|
|
65
69
|
script.async = true;
|
|
66
70
|
script.src = `${GTAG_URL}?id=${this.config.measurementId}`;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
window.dataLayer.push(args);
|
|
71
|
+
script.onload = () => {
|
|
72
|
+
window.gtag("js", /* @__PURE__ */ new Date());
|
|
73
|
+
window.gtag("config", this.config.measurementId);
|
|
74
|
+
resolve();
|
|
72
75
|
};
|
|
73
|
-
window.gtag("js", /* @__PURE__ */ new Date());
|
|
74
|
-
window.gtag("config", this.config.measurementId, {
|
|
75
|
-
send_page_view: false
|
|
76
|
-
});
|
|
77
|
-
script.onload = () => resolve();
|
|
78
76
|
script.onerror = () => resolve();
|
|
77
|
+
const firstScript = document.getElementsByTagName("script")[0];
|
|
78
|
+
firstScript.parentNode?.insertBefore(script, firstScript);
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
buildGtagResult() {
|