@launch77-shared/plugin-analytics-web 0.1.0 → 0.1.1
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/package.json +4 -2
- package/plugin.json +1 -1
- package/templates/src/app/analytics-test/page.tsx +18 -19
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@launch77-shared/plugin-analytics-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Launch77 plugin for analytics-web",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"plugin.json"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
+
"prebuild": "node scripts/validate-plugin-json.js",
|
|
17
18
|
"build": "tsup",
|
|
18
19
|
"dev": "tsup --watch",
|
|
19
20
|
"typecheck": "tsc --noEmit",
|
|
@@ -22,7 +23,8 @@
|
|
|
22
23
|
"release:verify": "launch77-release-verify"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"@launch77/
|
|
26
|
+
"@launch77-shared/lib-analytics-web": "^0.3.1",
|
|
27
|
+
"@launch77/plugin-runtime": "^0.3.2",
|
|
26
28
|
"chalk": "^5.3.0"
|
|
27
29
|
},
|
|
28
30
|
"devDependencies": {
|
package/plugin.json
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { useAnalytics, usePageTracking, CTAButton } from '@launch77-shared/lib-analytics-web'
|
|
4
4
|
import { useEffect } from 'react'
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
import { CodeExample } from './components/CodeExample'
|
|
7
|
+
import { ConsentDisplay } from './components/ConsentDisplay'
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Analytics Test Page
|
|
@@ -22,10 +23,10 @@ export default function AnalyticsTestPage() {
|
|
|
22
23
|
useEffect(() => {
|
|
23
24
|
// Track custom event on page load
|
|
24
25
|
trackCustom({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
name: 'page_visit',
|
|
27
|
+
parameters: {
|
|
28
|
+
category: 'test',
|
|
29
|
+
label: 'Analytics Test Page',
|
|
29
30
|
timestamp: new Date().toISOString(),
|
|
30
31
|
},
|
|
31
32
|
})
|
|
@@ -42,10 +43,9 @@ export default function AnalyticsTestPage() {
|
|
|
42
43
|
const handleFormSubmit = (e: React.FormEvent) => {
|
|
43
44
|
e.preventDefault()
|
|
44
45
|
trackForm({
|
|
45
|
-
action: 'submit',
|
|
46
|
-
category: 'test',
|
|
47
|
-
label: 'Test Form',
|
|
48
46
|
formName: 'analytics_test_form',
|
|
47
|
+
action: 'submit',
|
|
48
|
+
fields: ['name', 'email'],
|
|
49
49
|
})
|
|
50
50
|
alert('Form submitted! Check your analytics dashboard.')
|
|
51
51
|
}
|
|
@@ -122,10 +122,9 @@ export default function AnalyticsTestPage() {
|
|
|
122
122
|
</button>
|
|
123
123
|
</form>
|
|
124
124
|
<CodeExample>{`trackForm({
|
|
125
|
+
formName: 'analytics_test_form',
|
|
125
126
|
action: 'submit',
|
|
126
|
-
|
|
127
|
-
label: 'Test Form',
|
|
128
|
-
formName: 'analytics_test_form'
|
|
127
|
+
fields: ['name', 'email']
|
|
129
128
|
})`}</CodeExample>
|
|
130
129
|
</section>
|
|
131
130
|
|
|
@@ -138,10 +137,10 @@ export default function AnalyticsTestPage() {
|
|
|
138
137
|
<button
|
|
139
138
|
onClick={() =>
|
|
140
139
|
trackCustom({
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
name: 'custom_event',
|
|
141
|
+
parameters: {
|
|
142
|
+
category: 'test',
|
|
143
|
+
label: 'Custom Event Example',
|
|
145
144
|
timestamp: new Date().toISOString(),
|
|
146
145
|
userAction: 'button_click',
|
|
147
146
|
testId: Math.random().toString(36).substring(7),
|
|
@@ -153,10 +152,10 @@ export default function AnalyticsTestPage() {
|
|
|
153
152
|
Send Custom Event
|
|
154
153
|
</button>
|
|
155
154
|
<CodeExample>{`trackCustom({
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
name: 'custom_event',
|
|
156
|
+
parameters: {
|
|
157
|
+
category: 'test',
|
|
158
|
+
label: 'Custom Event Example',
|
|
160
159
|
timestamp: new Date().toISOString(),
|
|
161
160
|
userAction: 'button_click'
|
|
162
161
|
}
|