@funnel10x/tracking 1.4.0 → 2.0.0
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 +187 -76
- package/dist/THIRD_PARTY_LICENSES.txt +0 -850
- package/dist/gtm.html +3 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.js +10 -12
- package/dist/tag.js +10 -12
- package/package.json +3 -3
package/dist/gtm.html
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
<!-- @funnel10x/tracking@
|
|
1
|
+
<!-- @funnel10x/tracking@2.0.0: a tag do GTM (Custom HTML, em All Pages), em vez da tag oficial do PostHog e nunca ao lado dela. Só se mudam a chave, o apiHost (o proxy gerido da account, se o tiver) e, numa emergência, o sdkVersion (uma versão exacta do posthog-js); uma versão nova do pacote é um ficheiro novo. -->
|
|
2
2
|
<script>
|
|
3
3
|
window.f10xTracking = {
|
|
4
4
|
key: '{{PostHog project key}}',
|
|
5
5
|
apiHost: '',
|
|
6
|
+
sdkVersion: '',
|
|
6
7
|
checkoutHosts: []
|
|
7
8
|
}
|
|
8
9
|
</script>
|
|
9
|
-
<script src="https://cdn.jsdelivr.net/npm/@funnel10x/tracking@
|
|
10
|
+
<script src="https://cdn.jsdelivr.net/npm/@funnel10x/tracking@2.0.0/dist/tag.js" integrity="sha384-vl05BcvhQ0/QtZcEpJZuNM5QB/vPrQB7HVeN58LFs+oG43IoUfgu6Oi6SntNrjyH" crossorigin="anonymous"></script>
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,10 @@ import type { PostHog } from 'posthog-js'
|
|
|
3
3
|
export interface TrackingOptions {
|
|
4
4
|
/** The PostHog project key of the account (`phc_…`). */
|
|
5
5
|
key: string
|
|
6
|
-
/** Where events go: the proxy on the site's own domain (`/_t`) in a direct repo; PostHog US by default. */
|
|
6
|
+
/** Where events go: the proxy on the site's own domain (`/_t`) in a direct repo, the account's managed proxy in a tag; PostHog US by default. The SDK (`array.js`) loads from the same host's assets. */
|
|
7
7
|
apiHost?: string
|
|
8
|
+
/** An exact posthog-js version (`1.438.9`), for an emergency only: without it the 1.x channel of the PostHog CDN loads, and updates itself like the official tag. */
|
|
9
|
+
sdkVersion?: string
|
|
8
10
|
/** The `consent` of a direct site's `site.json`; without it there is no switch and the snippet runs. */
|
|
9
11
|
consent?: boolean
|
|
10
12
|
/** The version of the page being served (direct site). */
|
|
@@ -15,7 +17,7 @@ export interface TrackingOptions {
|
|
|
15
17
|
checkoutHosts?: string[]
|
|
16
18
|
/** Add the missing hidden fields to lead forms (default true). */
|
|
17
19
|
addFields?: boolean
|
|
18
|
-
/** posthog-js options on top of this package's. */
|
|
20
|
+
/** posthog-js options on top of this package's (turning a feature off on one site, tests). */
|
|
19
21
|
posthog?: Record<string, unknown>
|
|
20
22
|
}
|
|
21
23
|
|
|
@@ -28,12 +30,11 @@ export interface Tracking {
|
|
|
28
30
|
onReady(fn: (ready: true) => void): void
|
|
29
31
|
fields(): Record<string, string>
|
|
30
32
|
capture(event: string, properties?: Record<string, unknown>): void
|
|
33
|
+
/** The PostHog instance once the SDK has loaded; the stub (which queues calls) until then. */
|
|
31
34
|
posthog: PostHog | null
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
export const VERSION: string
|
|
35
38
|
export const CONSENT_KEY: string
|
|
36
39
|
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
40
|
export function init(options: TrackingOptions): Tracking
|