@lupinum/ginko-docs 0.3.0-rc.2 → 0.3.0-rc.3
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 +1 -1
- package/app/composables/useGinkoAnalytics.ts +14 -3
- package/nuxt.config.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Ginko Docs is a Nuxt layer for focused documentation sites. It combines Ginko Co
|
|
|
15
15
|
Install the layer and its Ginko Content peer:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
pnpm add -D @lupinum/ginko-docs@0.3.0-rc.
|
|
18
|
+
pnpm add -D @lupinum/ginko-docs@0.3.0-rc.3 @lupinum/ginko-content@0.4.0-rc.1
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
Keep the public identity in one shared value:
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { useScriptPlausibleAnalytics } from "#imports";
|
|
2
2
|
import { useGinkoDocsConfig } from "./useGinkoDocsConfig";
|
|
3
3
|
|
|
4
|
+
const PLAUSIBLE_INITIALIZER =
|
|
5
|
+
"window.plausible=window.plausible||function(){(plausible.q=plausible.q||[]).push(arguments)},plausible.init=plausible.init||function(i){plausible.o=i||{}};plausible.init()";
|
|
6
|
+
|
|
4
7
|
export type AnalyticsProps = Record<string, string>;
|
|
5
8
|
|
|
6
9
|
export interface GinkoAnalytics {
|
|
@@ -21,11 +24,19 @@ export function useGinkoAnalytics(): GinkoAnalytics {
|
|
|
21
24
|
return { enabled: false, track: () => {} };
|
|
22
25
|
}
|
|
23
26
|
|
|
27
|
+
const src = `https://plausible.io/js/pa-${scriptId}.js`;
|
|
28
|
+
useHead({
|
|
29
|
+
script: [
|
|
30
|
+
{ key: "plausibleAnalytics", src, async: true },
|
|
31
|
+
{ key: "plausibleAnalyticsInit", innerHTML: PLAUSIBLE_INITIALIZER },
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
|
|
24
35
|
const script = useScriptPlausibleAnalytics({
|
|
25
36
|
scriptId,
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
37
|
+
// Plausible verifies its exact snippet in server-rendered HTML. The head
|
|
38
|
+
// entry above provides it; Nuxt Scripts reuses the same keyed script for
|
|
39
|
+
// its typed proxy and lifecycle instead of adding a second tracker.
|
|
29
40
|
scriptOptions: { bundle: false },
|
|
30
41
|
});
|
|
31
42
|
|
package/nuxt.config.ts
CHANGED