stat18ion 0.1.3 → 0.1.4
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 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -112,3 +112,13 @@ const Analytics = () => {
|
|
|
112
112
|
return null;
|
|
113
113
|
};
|
|
114
114
|
exports.Analytics = Analytics;
|
|
115
|
+
// Auto-initialize if running in a browser and script tag has data-site-id
|
|
116
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
117
|
+
const script = document.currentScript || document.querySelector('script[data-site-id]');
|
|
118
|
+
if (script) {
|
|
119
|
+
const siteId = script.getAttribute('data-site-id');
|
|
120
|
+
if (siteId && !config.siteId) {
|
|
121
|
+
(0, exports.init)({ siteId });
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|