logos-kit 1.0.0 → 1.0.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/ClickTracker.tsx +16 -0
- package/package.json +5 -3
package/ClickTracker.tsx
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { track } from "./analytics";
|
|
4
|
+
|
|
5
|
+
export default function ClickTracker(): null {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const handler = (e: MouseEvent) => {
|
|
8
|
+
const el = (e.target as Element).closest("[data-track]");
|
|
9
|
+
if (!el) return;
|
|
10
|
+
track.ctaClick(el.getAttribute("data-track")!);
|
|
11
|
+
};
|
|
12
|
+
document.addEventListener("click", handler);
|
|
13
|
+
return () => document.removeEventListener("click", handler);
|
|
14
|
+
}, []);
|
|
15
|
+
return null;
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "logos-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Shared components and styles for Logos Web Studio sites",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -11,13 +11,15 @@
|
|
|
11
11
|
"ScrollReveal.tsx",
|
|
12
12
|
"animations.css",
|
|
13
13
|
"GoogleAnalytics.tsx",
|
|
14
|
-
"analytics.ts"
|
|
14
|
+
"analytics.ts",
|
|
15
|
+
"ClickTracker.tsx"
|
|
15
16
|
],
|
|
16
17
|
"exports": {
|
|
17
18
|
"./ScrollReveal": "./ScrollReveal.tsx",
|
|
18
19
|
"./animations.css": "./animations.css",
|
|
19
20
|
"./GoogleAnalytics": "./GoogleAnalytics.tsx",
|
|
20
|
-
"./analytics": "./analytics.ts"
|
|
21
|
+
"./analytics": "./analytics.ts",
|
|
22
|
+
"./ClickTracker": "./ClickTracker.tsx"
|
|
21
23
|
},
|
|
22
24
|
"peerDependencies": {
|
|
23
25
|
"react": ">=18",
|