@blotoutio/providers-google-analytics-4-sdk 0.6.5

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.
Files changed (3) hide show
  1. package/README.md +3 -0
  2. package/index.js +31 -0
  3. package/package.json +21 -0
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # EdgeTag Google Analytics 4 adapter
2
+
3
+ More info on https://app.edgetag.io/integration
package/index.js ADDED
@@ -0,0 +1,31 @@
1
+ var ProvidersGoogleAnalytics4Sdk = (function () {
2
+ 'use strict';
3
+
4
+ const init = ({ manifest, userId }) => {
5
+ if (!manifest.variables || !window || !window.gtag) {
6
+ return;
7
+ }
8
+ window.gtag('config', manifest.variables['googleAnalytics4MeasurementId'], {
9
+ user_id: userId,
10
+ });
11
+ };
12
+
13
+ const data = {
14
+ name: 'googleAnalytics4',
15
+ init,
16
+ };
17
+ try {
18
+ if (window) {
19
+ if (!window.edgetagProviders) {
20
+ window.edgetagProviders = [];
21
+ }
22
+ window.edgetagProviders.push(data);
23
+ }
24
+ }
25
+ catch (_a) {
26
+ // No window
27
+ }
28
+
29
+ return data;
30
+
31
+ })();
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@blotoutio/providers-google-analytics-4-sdk",
3
+ "version": "0.6.5",
4
+ "description": "Google Analytics 4 Browser SDK for EdgeTag",
5
+ "author": "Blotout",
6
+ "license": "MIT",
7
+ "homepage": "https://github.com/blotoutio/edgetag-sdk",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "main": "./index.js",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/blotoutio/edgetag-sdk.git"
15
+ },
16
+ "files": [
17
+ "index.js",
18
+ "package.json",
19
+ "README.md"
20
+ ]
21
+ }