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