@jenil_121/ga-bridge 1.0.1 → 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.
- package/README.md +45 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Twinalyze GA Bridge
|
|
2
2
|
|
|
3
|
-
Twinalyze GA Bridge is a
|
|
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
|
-
|
|
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
|
-
|
|
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
|