@funnel10x/tracking 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +225 -2
- package/dist/THIRD_PARTY_LICENSES.txt +873 -0
- package/dist/gtm.html +8 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +15 -0
- package/dist/tag.js +15 -0
- package/package.json +34 -4
package/dist/gtm.html
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<!-- @funnel10x/tracking@1.0.1: a tag do GTM (Custom HTML, em All Pages). Só se muda a chave; uma versão nova é um ficheiro novo. -->
|
|
2
|
+
<script>
|
|
3
|
+
window.f10xTracking = {
|
|
4
|
+
key: '{{PostHog project key}}',
|
|
5
|
+
checkoutHosts: []
|
|
6
|
+
}
|
|
7
|
+
</script>
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/@funnel10x/tracking@1.0.1/dist/tag.js" integrity="sha384-TAV0wuwYZm3WbN/Lo9h2OzbAV0v6n3YnnyezN4+GuNeHWOaCDb+puCe0BRHE1rBx" crossorigin="anonymous"></script>
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PostHog } from 'posthog-js'
|
|
2
|
+
|
|
3
|
+
export interface TrackingOptions {
|
|
4
|
+
/** The PostHog project key of the account (`phc_…`). */
|
|
5
|
+
key: string
|
|
6
|
+
/** Where events go: the proxy on the site's own domain (`/_t`) in a direct repo; PostHog US by default. */
|
|
7
|
+
apiHost?: string
|
|
8
|
+
/** The `consent` of a direct site's `site.json`; without it there is no switch and the snippet runs. */
|
|
9
|
+
consent?: boolean
|
|
10
|
+
/** The version of the page being served (direct site). */
|
|
11
|
+
pageVersion?: number
|
|
12
|
+
/** The active test of the page, `/pt/f1/lp#2` (direct site). */
|
|
13
|
+
test?: string | null
|
|
14
|
+
/** Checkout hosts whose links carry the ids, besides Stripe's. */
|
|
15
|
+
checkoutHosts?: string[]
|
|
16
|
+
/** Add the missing hidden fields to lead forms (default true). */
|
|
17
|
+
addFields?: boolean
|
|
18
|
+
/** posthog-js options on top of this package's. */
|
|
19
|
+
posthog?: Record<string, unknown>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface Tracking {
|
|
23
|
+
version: string
|
|
24
|
+
mode: 'direct' | 'tag' | 'preview' | 'frame'
|
|
25
|
+
consent(): 'granted' | 'denied' | null
|
|
26
|
+
grant(): void
|
|
27
|
+
deny(): void
|
|
28
|
+
onReady(fn: (ready: true) => void): void
|
|
29
|
+
fields(): Record<string, string>
|
|
30
|
+
capture(event: string, properties?: Record<string, unknown>): void
|
|
31
|
+
posthog: PostHog | null
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const VERSION: string
|
|
35
|
+
export const CONSENT_KEY: string
|
|
36
|
+
export const ALLOWED_PARAMS: string[]
|
|
37
|
+
export function cleanUrl(value: string, base?: string): string
|
|
38
|
+
export function cleanEvent<T>(event: T, base?: string): T
|
|
39
|
+
export function init(options: TrackingOptions): Tracking
|