@doreamonjs/plugin-analysis 1.8.39 → 1.9.9

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.9.9](https://github.com/doreamonjs/doreamon/compare/v1.9.8...v1.9.9) (2023-08-19)
7
+
8
+ **Note:** Version bump only for package @doreamonjs/plugin-analysis
9
+
10
+
11
+
12
+
13
+
6
14
  ## [1.8.39](https://github.com/doreamonjs/doreamon/compare/v1.8.38...v1.8.39) (2023-08-04)
7
15
 
8
16
  **Note:** Version bump only for package @doreamonjs/plugin-analysis
package/lib/service.js CHANGED
@@ -91,6 +91,36 @@ class Service {
91
91
  (_a = instance === null || instance === void 0 ? void 0 : instance.track) === null || _a === void 0 ? void 0 : _a.call(instance, event, attributes);
92
92
  },
93
93
  },
94
+ 'umami': {
95
+ setup: async (config) => {
96
+ if (!(config === null || config === void 0 ? void 0 : config.id) || !(config === null || config === void 0 ? void 0 : config.server)) {
97
+ this.logger.error('umami config server and id are missing');
98
+ return;
99
+ }
100
+ // @TODO attributes need setAttribute(key, value) instead of script[key] = value
101
+ // await doreamon.fs.loadJs(`${config.server}/umami.js`, {
102
+ // defer: true,
103
+ // 'data-website-id': config.id,
104
+ // });
105
+ await new Promise((resolve, reject) => {
106
+ var el = document.createElement('script');
107
+ el.async = true;
108
+ el.defer = true;
109
+ el.setAttribute('src', `${config.server}/umami.js`);
110
+ el.setAttribute('data-website-id', config.id);
111
+ el.onerror = reject;
112
+ el.onload = function () {
113
+ resolve();
114
+ };
115
+ document.head.appendChild(el);
116
+ });
117
+ return window.umami;
118
+ },
119
+ track: (instance, event, attributes) => {
120
+ var _a;
121
+ (_a = instance === null || instance === void 0 ? void 0 : instance.track) === null || _a === void 0 ? void 0 : _a.call(instance, event, attributes);
122
+ },
123
+ },
94
124
  };
95
125
  }
96
126
  get namespace() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doreamonjs/plugin-analysis",
3
- "version": "1.8.39",
3
+ "version": "1.9.9",
4
4
  "description": "analysis plugin for doreamonjs",
5
5
  "keywords": [
6
6
  "doreamonjs",
@@ -78,5 +78,5 @@
78
78
  "mixpanel-browser": "^2.45.0",
79
79
  "thinkingdata-browser": "^1.6.0"
80
80
  },
81
- "gitHead": "00c99aa14a17841adc4926b7167970429e8097b1"
81
+ "gitHead": "32ea3f74f51c3c8e67b5cd4181cc9d1212e4d94a"
82
82
  }