Download react-spring/docs/app/helpers/analytics.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 861 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/docs/app/helpers/analytics.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/docs/app/helpers/analytics.ts
-
curl -L -o analytics.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/docs/app/helpers/analytics.ts
861 Bytes
| export enum EventNames { | |
| OutboundLink = 'Outbound Link', | |
| DocLiked = 'Doc Liked', | |
| DocDisliked = 'Doc Disliked', | |
| LinkedToSandbox = 'Linked to Sandbox', | |
| } | |
| type EventFactory< | |
| TEventName extends EventNames, | |
| TAdditionalProps extends object = object, | |
| > = { | |
| name: TEventName | |
| additionalProps?: TAdditionalProps | |
| } | |
| type OutboundLinkEvent = EventFactory< | |
| EventNames.OutboundLink, | |
| { | |
| linkTitle: string | |
| } | |
| > | |
| type VotingEvent = EventFactory< | |
| EventNames.DocLiked | EventNames.DocDisliked, | |
| { | |
| location: string | |
| title: string | |
| } | |
| > | |
| type SandboxEvent = EventFactory< | |
| EventNames.LinkedToSandbox, | |
| { | |
| title: string | |
| } | |
| > | |
| type Events = OutboundLinkEvent | VotingEvent | SandboxEvent | |
| export const firePlausibleEvent = (event: Events) => { | |
| if (window.plausible) { | |
| window.plausible(event.name, { props: event.additionalProps }) | |
| } | |
| } | |