@jwiedeman/gtm-kit-svelte 1.1.2 → 1.1.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 +29 -29
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @jwiedeman/gtm-kit-svelte
|
|
2
2
|
|
|
3
3
|
[](https://github.com/jwiedeman/react-gtm-kit/actions/workflows/ci.yml)
|
|
4
4
|
[](https://codecov.io/gh/jwiedeman/react-gtm-kit)
|
|
5
|
-
[](https://www.npmjs.com/package/@jwiedeman/gtm-kit-svelte)
|
|
6
|
+
[](https://bundlephobia.com/package/@jwiedeman/gtm-kit-svelte)
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
9
|
[](https://svelte.dev/)
|
|
@@ -17,15 +17,15 @@ The Svelte adapter for GTM Kit - provides stores and context for idiomatic Svelt
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install @
|
|
20
|
+
npm install @jwiedeman/gtm-kit @jwiedeman/gtm-kit-svelte
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
yarn add @
|
|
24
|
+
yarn add @jwiedeman/gtm-kit @jwiedeman/gtm-kit-svelte
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
pnpm add @
|
|
28
|
+
pnpm add @jwiedeman/gtm-kit @jwiedeman/gtm-kit-svelte
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
---
|
|
@@ -37,7 +37,7 @@ pnpm add @react-gtm-kit/core @react-gtm-kit/svelte
|
|
|
37
37
|
```svelte
|
|
38
38
|
<!-- src/routes/+layout.svelte -->
|
|
39
39
|
<script>
|
|
40
|
-
import { createGtmStore, setGtmContext } from '@
|
|
40
|
+
import { createGtmStore, setGtmContext } from '@jwiedeman/gtm-kit-svelte';
|
|
41
41
|
|
|
42
42
|
const gtm = createGtmStore({ containers: 'GTM-XXXXXX' });
|
|
43
43
|
setGtmContext(gtm);
|
|
@@ -51,7 +51,7 @@ pnpm add @react-gtm-kit/core @react-gtm-kit/svelte
|
|
|
51
51
|
```svelte
|
|
52
52
|
<!-- src/routes/+page.svelte -->
|
|
53
53
|
<script>
|
|
54
|
-
import { getGtmContext } from '@
|
|
54
|
+
import { getGtmContext } from '@jwiedeman/gtm-kit-svelte';
|
|
55
55
|
|
|
56
56
|
const gtm = getGtmContext();
|
|
57
57
|
|
|
@@ -69,14 +69,14 @@ pnpm add @react-gtm-kit/core @react-gtm-kit/svelte
|
|
|
69
69
|
|
|
70
70
|
## Features
|
|
71
71
|
|
|
72
|
-
| Feature
|
|
73
|
-
|
|
74
|
-
| **Svelte Stores**
|
|
75
|
-
| **Context API**
|
|
76
|
-
| **Reactive**
|
|
77
|
-
| **TypeScript**
|
|
78
|
-
| **Consent Mode v2** | Built-in GDPR compliance
|
|
79
|
-
| **SSR Compatible**
|
|
72
|
+
| Feature | Description |
|
|
73
|
+
| ------------------- | ------------------------------- |
|
|
74
|
+
| **Svelte Stores** | Native Svelte store integration |
|
|
75
|
+
| **Context API** | Uses Svelte context for DI |
|
|
76
|
+
| **Reactive** | Fully reactive with `$` syntax |
|
|
77
|
+
| **TypeScript** | Full type definitions included |
|
|
78
|
+
| **Consent Mode v2** | Built-in GDPR compliance |
|
|
79
|
+
| **SSR Compatible** | Safe for SvelteKit SSR |
|
|
80
80
|
|
|
81
81
|
---
|
|
82
82
|
|
|
@@ -88,7 +88,7 @@ Creates a new GTM store. Call this once in your root layout.
|
|
|
88
88
|
|
|
89
89
|
```svelte
|
|
90
90
|
<script>
|
|
91
|
-
import { createGtmStore, setGtmContext } from '@
|
|
91
|
+
import { createGtmStore, setGtmContext } from '@jwiedeman/gtm-kit-svelte';
|
|
92
92
|
|
|
93
93
|
const gtm = createGtmStore({
|
|
94
94
|
containers: 'GTM-XXXXXX',
|
|
@@ -108,7 +108,7 @@ Gets the GTM store from context. Use in child components.
|
|
|
108
108
|
|
|
109
109
|
```svelte
|
|
110
110
|
<script>
|
|
111
|
-
import { getGtmContext } from '@
|
|
111
|
+
import { getGtmContext } from '@jwiedeman/gtm-kit-svelte';
|
|
112
112
|
|
|
113
113
|
const gtm = getGtmContext();
|
|
114
114
|
|
|
@@ -123,7 +123,7 @@ Get a derived store for just the push function.
|
|
|
123
123
|
|
|
124
124
|
```svelte
|
|
125
125
|
<script>
|
|
126
|
-
import { gtmPush } from '@
|
|
126
|
+
import { gtmPush } from '@jwiedeman/gtm-kit-svelte';
|
|
127
127
|
|
|
128
128
|
const push = gtmPush();
|
|
129
129
|
|
|
@@ -139,7 +139,7 @@ Get a derived store for consent functions.
|
|
|
139
139
|
|
|
140
140
|
```svelte
|
|
141
141
|
<script>
|
|
142
|
-
import { gtmConsent } from '@
|
|
142
|
+
import { gtmConsent } from '@jwiedeman/gtm-kit-svelte';
|
|
143
143
|
|
|
144
144
|
const consent = gtmConsent();
|
|
145
145
|
|
|
@@ -158,7 +158,7 @@ Get a derived store for the raw GTM client.
|
|
|
158
158
|
|
|
159
159
|
```svelte
|
|
160
160
|
<script>
|
|
161
|
-
import { gtmClient } from '@
|
|
161
|
+
import { gtmClient } from '@jwiedeman/gtm-kit-svelte';
|
|
162
162
|
|
|
163
163
|
const client = gtmClient();
|
|
164
164
|
</script>
|
|
@@ -170,7 +170,7 @@ Get a derived store for the whenReady function.
|
|
|
170
170
|
|
|
171
171
|
```svelte
|
|
172
172
|
<script>
|
|
173
|
-
import { gtmReady } from '@
|
|
173
|
+
import { gtmReady } from '@jwiedeman/gtm-kit-svelte';
|
|
174
174
|
import { onMount } from 'svelte';
|
|
175
175
|
|
|
176
176
|
const whenReady = gtmReady();
|
|
@@ -191,7 +191,7 @@ Get a derived store for the whenReady function.
|
|
|
191
191
|
```svelte
|
|
192
192
|
<!-- src/routes/+layout.svelte -->
|
|
193
193
|
<script>
|
|
194
|
-
import { createGtmStore, setGtmContext } from '@
|
|
194
|
+
import { createGtmStore, setGtmContext } from '@jwiedeman/gtm-kit-svelte';
|
|
195
195
|
import { browser } from '$app/environment';
|
|
196
196
|
|
|
197
197
|
// Only create store in browser
|
|
@@ -209,7 +209,7 @@ Get a derived store for the whenReady function.
|
|
|
209
209
|
```svelte
|
|
210
210
|
<!-- src/routes/+layout.svelte -->
|
|
211
211
|
<script>
|
|
212
|
-
import { createGtmStore, setGtmContext } from '@
|
|
212
|
+
import { createGtmStore, setGtmContext } from '@jwiedeman/gtm-kit-svelte';
|
|
213
213
|
import { page } from '$app/stores';
|
|
214
214
|
import { browser } from '$app/environment';
|
|
215
215
|
|
|
@@ -239,8 +239,8 @@ Get a derived store for the whenReady function.
|
|
|
239
239
|
```svelte
|
|
240
240
|
<!-- src/routes/+layout.svelte -->
|
|
241
241
|
<script>
|
|
242
|
-
import { createGtmStore, setGtmContext } from '@
|
|
243
|
-
import { consentPresets } from '@
|
|
242
|
+
import { createGtmStore, setGtmContext } from '@jwiedeman/gtm-kit-svelte';
|
|
243
|
+
import { consentPresets } from '@jwiedeman/gtm-kit';
|
|
244
244
|
import { browser } from '$app/environment';
|
|
245
245
|
|
|
246
246
|
if (browser) {
|
|
@@ -261,7 +261,7 @@ Get a derived store for the whenReady function.
|
|
|
261
261
|
```svelte
|
|
262
262
|
<!-- src/lib/CookieBanner.svelte -->
|
|
263
263
|
<script>
|
|
264
|
-
import { gtmConsent } from '@
|
|
264
|
+
import { gtmConsent } from '@jwiedeman/gtm-kit-svelte';
|
|
265
265
|
|
|
266
266
|
const consent = gtmConsent();
|
|
267
267
|
|
|
@@ -325,7 +325,7 @@ Full TypeScript support is included:
|
|
|
325
325
|
|
|
326
326
|
```svelte
|
|
327
327
|
<script lang="ts">
|
|
328
|
-
import { getGtmContext, type GtmStoreValue } from '@
|
|
328
|
+
import { getGtmContext, type GtmStoreValue } from '@jwiedeman/gtm-kit-svelte';
|
|
329
329
|
import type { Writable } from 'svelte/store';
|
|
330
330
|
|
|
331
331
|
const gtm: Writable<GtmStoreValue> = getGtmContext();
|
|
@@ -337,7 +337,7 @@ Full TypeScript support is included:
|
|
|
337
337
|
## Requirements
|
|
338
338
|
|
|
339
339
|
- Svelte 4.0+ or 5.0+
|
|
340
|
-
- `@
|
|
340
|
+
- `@jwiedeman/gtm-kit` (peer dependency)
|
|
341
341
|
|
|
342
342
|
---
|
|
343
343
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jwiedeman/gtm-kit-svelte",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Svelte stores and actions for GTM Kit - Google Tag Manager integration.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"typecheck": "tsc --noEmit"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@jwiedeman/gtm-kit": "^1.1.
|
|
45
|
+
"@jwiedeman/gtm-kit": "^1.1.3"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"svelte": "^4.0.0 || ^5.0.0"
|