@sarimarcus/content-sites-ui 0.49.1 → 0.49.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/CHANGELOG.md +4 -0
- package/package.json +2 -2
- package/src/layout/analytics.ts +14 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.49.2 (2026-10-26)
|
|
6
|
+
|
|
7
|
+
- Analytics: a same-origin link inside a `[data-track-zone]` element now fires `internal_link_click` with the zone as `link_block`, so a page tracks clicks per section without tagging every card (SLA-3512).
|
|
8
|
+
|
|
5
9
|
## 0.49.1 (2026-10-26)
|
|
6
10
|
|
|
7
11
|
- No changes; lockstep release with tourism (SLA-3510).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-ui",
|
|
3
|
-
"version": "0.49.
|
|
3
|
+
"version": "0.49.2",
|
|
4
4
|
"description": "Universal Astro UI components, layout shell and design tokens shared by the content sites.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
"@lucide/astro": "^1.23.0",
|
|
51
51
|
"astro": "^7.0.6",
|
|
52
52
|
"tailwindcss": "^4.1.18",
|
|
53
|
-
"@sarimarcus/content-sites-core": "0.49.
|
|
53
|
+
"@sarimarcus/content-sites-core": "0.49.2"
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/layout/analytics.ts
CHANGED
|
@@ -30,8 +30,17 @@ const HREF_DESTINATION_KEYS: Record<string, string> = {
|
|
|
30
30
|
internal_link_click: 'link_destination',
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
// A same-origin link inside a [data-track-zone] ancestor, or null.
|
|
34
|
+
export function zoneLinkOf(target: Element, origin: string): { link: HTMLAnchorElement; zone: string } | null {
|
|
35
|
+
const link = target.closest<HTMLAnchorElement>('a[href]');
|
|
36
|
+
if (!link || link.origin !== origin) return null;
|
|
37
|
+
const zone = link.closest<HTMLElement>('[data-track-zone]')?.dataset.trackZone;
|
|
38
|
+
return zone ? { link, zone } : null;
|
|
39
|
+
}
|
|
40
|
+
|
|
33
41
|
// Reads data-track-* attributes from the clicked element and fires track().
|
|
34
42
|
// Handles affiliate_click, cta_click, outbound_click, internal_link_click.
|
|
43
|
+
// An untagged same-origin link inside [data-track-zone] fires internal_link_click with the zone as link_block.
|
|
35
44
|
export function setupDelegatedTracking(): void {
|
|
36
45
|
// MPA — pathname is stable for the page's lifetime; compute once.
|
|
37
46
|
const pageType = pageTypeOf(window.location.pathname);
|
|
@@ -40,7 +49,11 @@ export function setupDelegatedTracking(): void {
|
|
|
40
49
|
const target = e.target;
|
|
41
50
|
if (!(target instanceof Element)) return;
|
|
42
51
|
const el = target.closest<HTMLElement>('[data-track-event]');
|
|
43
|
-
if (!el)
|
|
52
|
+
if (!el) {
|
|
53
|
+
const zoned = zoneLinkOf(target, window.location.origin);
|
|
54
|
+
if (zoned) track('internal_link_click', { page_type: pageType, link_block: zoned.zone, link_destination: zoned.link.href });
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
44
57
|
const eventName = el.dataset.trackEvent;
|
|
45
58
|
if (!eventName) return;
|
|
46
59
|
|