@jenil_121/ga-bridge 1.0.0 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +45 -4
  2. package/package.json +3 -4
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Twinalyze GA Bridge
2
2
 
3
- Twinalyze GA Bridge is a small browser bridge file that listens to GA4 `gtag('event', ...)` calls and forwards the same event to Twinalyze using the existing Twinalyze web SDK.
3
+ Twinalyze GA Bridge is a lightweight browser bridge that listens to GA4 `gtag('event', ...)` calls and forwards the same event to Twinalyze using the existing Twinalyze web SDK.
4
4
 
5
5
  ## What it does
6
6
 
@@ -18,14 +18,55 @@ Twinalyze GA Bridge is a small browser bridge file that listens to GA4 `gtag('ev
18
18
 
19
19
  ## Installation
20
20
 
21
- ### 1. Load Twinalyze SDK
21
+ Load scripts in this order:
22
+
23
+ 1. Google Analytics
24
+ 2. Twinalyze Web SDK
25
+ 3. Twinalyze GA Bridge
22
26
 
23
27
  ```html
24
- <script src="https://cdn.jsdelivr.net/npm/@twinalyze/web-analytics@1.0.14/dist/cdn.global.min.js" integrity="sha256-MyLqo5EG9WAfTSAH96HUCFkqNxTZkhllLCON+iG0EsM=" crossorigin="anonymous"></script>
28
+ <!-- 1. Load GA -->
29
+ <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX"></script>
30
+ <script>
31
+ window.dataLayer = window.dataLayer || [];
32
+ function gtag(){ dataLayer.push(arguments); }
33
+ gtag('js', new Date());
34
+ gtag('config', 'G-XXXXXXXX');
35
+ </script>
36
+
37
+ <!-- 2. Load Twinalyze SDK -->
38
+ <script src="https://cdn.jsdelivr.net/npm/@twinalyze/web-analytics@1.0.14/dist/cdn.global.min.js"></script>
25
39
  <script>
26
40
  window.twinalyze.init({
27
41
  apiKey: "PUBLIC_WRITE_KEY",
28
42
  organization: "ORG_ID",
29
43
  socketUrl: "https://www.twinalyze.com/"
30
44
  });
31
- </script>
45
+ </script>
46
+
47
+ <!-- 3. Load Twinalyze GA Bridge -->
48
+ <script src="https://cdn.jsdelivr.net/npm/@jenil_121/ga-bridge@1.0.1/dist/twinalyze-ga-bridge.min.js"></script>
49
+ ```
50
+
51
+ ## Usage
52
+
53
+ After setup, use GA normally:
54
+
55
+ ```html
56
+ <script>
57
+ gtag('event', 'purchase', {
58
+ value: 999,
59
+ currency: 'INR'
60
+ });
61
+ </script>
62
+ ```
63
+
64
+ This event will be sent to:
65
+ - Google Analytics
66
+ - Twinalyze
67
+
68
+ ## Notes
69
+
70
+ - The bridge depends on both `window.gtag` and `window.twinalyze`
71
+ - Load order is important
72
+ - This package is a bridge plugin, not a replacement for the Twinalyze SDK
package/package.json CHANGED
@@ -1,12 +1,11 @@
1
1
  {
2
2
  "name": "@jenil_121/ga-bridge",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "GA4 to Twinalyze browser bridge",
5
5
  "main": "dist/twinalyze-ga-bridge.min.js",
6
6
  "files": [
7
7
  "dist",
8
- "README.md",
9
- "LICENSE"
8
+ "README.md"
10
9
  ],
11
10
  "scripts": {
12
11
  "build": "terser src/twinalyze-ga-bridge.js -c -m -o dist/twinalyze-ga-bridge.min.js",
@@ -16,4 +15,4 @@
16
15
  "access": "public"
17
16
  },
18
17
  "license": "MIT"
19
- }
18
+ }