@hagicode/hagilight-core 0.9.7 → 0.9.8-dev.115.1.3488f89
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 +7 -4
- package/dist/analytics-events.d.ts +2 -2
- package/dist/analytics-events.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -116,8 +116,8 @@ A click on a tagged link calls `gtag('event', <action>, …)` once:
|
|
|
116
116
|
|
|
117
117
|
| Field | Value |
|
|
118
118
|
| --- | --- |
|
|
119
|
-
| Event name (action) | `download_click` for the `download` category, `link_click` for every other category |
|
|
120
|
-
| `event_category` | `download`, `navigation`, `community`, or `promotion` |
|
|
119
|
+
| Event name (action) | `download_click` for the `download` category, `store_visit` for the `store` category, `link_click` for every other category |
|
|
120
|
+
| `event_category` | `download`, `store`, `navigation`, `community`, or `promotion` |
|
|
121
121
|
| `event_label` | The link's stable id (for example `downloadClient`), never its localized text |
|
|
122
122
|
| `link_location` | Where the link sits: `header`, `footer`, `article_promotion`, `promoto_banner`, or your own value |
|
|
123
123
|
| `link_url` | The destination at click time |
|
|
@@ -129,12 +129,15 @@ Reporting never delays, cancels, or changes navigation, and carries no link text
|
|
|
129
129
|
|
|
130
130
|
The shared components tag exactly these links. The authoritative list is `TRACKED_SITE_LINKS` in `src/analytics-events.ts`; renaming a link id changes its GA label.
|
|
131
131
|
|
|
132
|
+
Use `store` for links to a store listing page (Microsoft Store, Steam), which reports `store_visit`. Use `download` for installers and download-hub entry points, which report `download_click`. A single click reports under one category only.
|
|
133
|
+
|
|
132
134
|
| `event_label` | `event_category` | Reported from |
|
|
133
135
|
| --- | --- | --- |
|
|
134
136
|
| `home`, `blog`, `support` | `navigation` | header (`home` also in the HagiCode showcase) |
|
|
135
137
|
| `dockerCompose`, `blogPosts` | `navigation` | footer quick links |
|
|
136
138
|
| `productDocs` | `navigation` | footer quick links, HagiCode showcase |
|
|
137
|
-
| `downloadClient
|
|
139
|
+
| `downloadClient` | `download` | footer quick links, HagiCode showcase (all-downloads link) |
|
|
140
|
+
| `microsoftStore` | `store` | footer quick links, HagiCode showcase (the Microsoft Store badge and its fallback link report `microsoftStore`) |
|
|
138
141
|
| `github`, `discord`, `issueFeedback` | `community` | footer community links |
|
|
139
142
|
| the promotion's id | `promotion` | floating promotion banner call to action, including rotated slides |
|
|
140
143
|
|
|
@@ -153,7 +156,7 @@ import { gaEventAttributes } from '@hagicode/hagilight-core/analytics-events';
|
|
|
153
156
|
>Download</a>
|
|
154
157
|
```
|
|
155
158
|
|
|
156
|
-
`gaEventAttributes()` returns the `data-ga-category`, `data-ga-label`, `data-ga-location`, and optional `data-ga-url` attributes (pass `url` when the tagged element has no `href` of its own). It throws a `TypeError` for an unknown category or an empty label or location. A hand-written `data-ga-*` tag with an invalid category is ignored at click time. The page must render `GoogleAnalytics` for the click to be reported. `siteLinkGaAttributes(link, location)` tags a resolved site link and returns `{}` for ids outside the tracked list.
|
|
159
|
+
`gaEventAttributes()` returns the `data-ga-category`, `data-ga-label`, `data-ga-location`, and optional `data-ga-url` attributes (pass `url` when the tagged element has no `href` of its own). It throws a `TypeError` for an unknown category or an empty label or location. The category must be one of `download`, `store`, `navigation`, `community`, or `promotion`; action names such as `store_visit` are not categories. For a store listing, use `category: 'store'`, for example `gaEventAttributes({ category: 'store', label: 'openSteamStore', location: 'pricing' })`. A hand-written `data-ga-*` tag with an invalid category is ignored at click time. The page must render `GoogleAnalytics` for the click to be reported. `siteLinkGaAttributes(link, location)` tags a resolved site link and returns `{}` for ids outside the tracked list.
|
|
157
160
|
|
|
158
161
|
### Reports
|
|
159
162
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SiteLink, SiteLinkKey } from './links.js';
|
|
2
|
-
export declare const GA_CATEGORIES: readonly ["download", "navigation", "community", "promotion"];
|
|
2
|
+
export declare const GA_CATEGORIES: readonly ["download", "store", "navigation", "community", "promotion"];
|
|
3
3
|
export type GaCategory = (typeof GA_CATEGORIES)[number];
|
|
4
|
-
export type GaAction = 'download_click' | 'link_click';
|
|
4
|
+
export type GaAction = 'download_click' | 'store_visit' | 'link_click';
|
|
5
5
|
export declare const GA_CATEGORY_ACTIONS: Readonly<Record<GaCategory, GaAction>>;
|
|
6
6
|
export declare const GA_LOCATIONS: readonly ["header", "footer", "article_promotion", "promoto_banner"];
|
|
7
7
|
export type GaLocation = (typeof GA_LOCATIONS)[number];
|
package/dist/analytics-events.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export const GA_CATEGORIES = ['download', 'navigation', 'community', 'promotion'];
|
|
1
|
+
export const GA_CATEGORIES = ['download', 'store', 'navigation', 'community', 'promotion'];
|
|
2
2
|
// GA4 has no native category/action/label: the action is the event name.
|
|
3
3
|
export const GA_CATEGORY_ACTIONS = Object.freeze({
|
|
4
4
|
download: 'download_click',
|
|
5
|
+
store: 'store_visit',
|
|
5
6
|
navigation: 'link_click',
|
|
6
7
|
community: 'link_click',
|
|
7
8
|
promotion: 'link_click',
|
|
@@ -13,7 +14,7 @@ export const TRACKED_SITE_LINKS = Object.freeze({
|
|
|
13
14
|
blog: 'navigation',
|
|
14
15
|
support: 'navigation',
|
|
15
16
|
downloadClient: 'download',
|
|
16
|
-
microsoftStore: '
|
|
17
|
+
microsoftStore: 'store',
|
|
17
18
|
dockerCompose: 'navigation',
|
|
18
19
|
productDocs: 'navigation',
|
|
19
20
|
blogPosts: 'navigation',
|
package/package.json
CHANGED