@jwiedeman/gtm-kit-remix 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.
Files changed (2) hide show
  1. package/README.md +75 -86
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # @react-gtm-kit/remix
1
+ # @jwiedeman/gtm-kit-remix
2
2
 
3
3
  [![CI](https://github.com/jwiedeman/react-gtm-kit/actions/workflows/ci.yml/badge.svg)](https://github.com/jwiedeman/react-gtm-kit/actions/workflows/ci.yml)
4
4
  [![Coverage](https://codecov.io/gh/jwiedeman/react-gtm-kit/graph/badge.svg?flag=remix)](https://codecov.io/gh/jwiedeman/react-gtm-kit)
5
- [![npm version](https://img.shields.io/npm/v/@react-gtm-kit/remix.svg)](https://www.npmjs.com/package/@react-gtm-kit/remix)
6
- [![Bundle Size](https://img.shields.io/bundlephobia/minzip/@react-gtm-kit/remix)](https://bundlephobia.com/package/@react-gtm-kit/remix)
5
+ [![npm version](https://img.shields.io/npm/v/@jwiedeman/gtm-kit-remix.svg)](https://www.npmjs.com/package/@jwiedeman/gtm-kit-remix)
6
+ [![Bundle Size](https://img.shields.io/bundlephobia/minzip/@jwiedeman/gtm-kit-remix)](https://bundlephobia.com/package/@jwiedeman/gtm-kit-remix)
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue.svg)](https://www.typescriptlang.org/)
8
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
9
  [![Remix](https://img.shields.io/badge/Remix-2.0+-000000.svg?logo=remix)](https://remix.run/)
@@ -17,15 +17,15 @@ The Remix adapter for GTM Kit - provides components and hooks optimized for Remi
17
17
  ## Installation
18
18
 
19
19
  ```bash
20
- npm install @react-gtm-kit/core @react-gtm-kit/remix
20
+ npm install @jwiedeman/gtm-kit @jwiedeman/gtm-kit-remix
21
21
  ```
22
22
 
23
23
  ```bash
24
- yarn add @react-gtm-kit/core @react-gtm-kit/remix
24
+ yarn add @jwiedeman/gtm-kit @jwiedeman/gtm-kit-remix
25
25
  ```
26
26
 
27
27
  ```bash
28
- pnpm add @react-gtm-kit/core @react-gtm-kit/remix
28
+ pnpm add @jwiedeman/gtm-kit @jwiedeman/gtm-kit-remix
29
29
  ```
30
30
 
31
31
  ---
@@ -36,7 +36,7 @@ pnpm add @react-gtm-kit/core @react-gtm-kit/remix
36
36
 
37
37
  ```tsx
38
38
  // app/root.tsx
39
- import { GtmProvider, GtmScripts, useTrackPageViews } from '@react-gtm-kit/remix';
39
+ import { GtmProvider, GtmScripts, useTrackPageViews } from '@jwiedeman/gtm-kit-remix';
40
40
 
41
41
  function PageViewTracker() {
42
42
  useTrackPageViews();
@@ -67,7 +67,7 @@ export default function App() {
67
67
 
68
68
  ```tsx
69
69
  // app/routes/products.$id.tsx
70
- import { useGtmPush } from '@react-gtm-kit/remix';
70
+ import { useGtmPush } from '@jwiedeman/gtm-kit-remix';
71
71
 
72
72
  export default function ProductPage() {
73
73
  const push = useGtmPush();
@@ -86,14 +86,14 @@ export default function ProductPage() {
86
86
 
87
87
  ## Features
88
88
 
89
- | Feature | Description |
90
- |---------|-------------|
91
- | **Remix Native** | Built specifically for Remix |
89
+ | Feature | Description |
90
+ | ---------------------- | ------------------------------------------ |
91
+ | **Remix Native** | Built specifically for Remix |
92
92
  | **Auto Page Tracking** | `useTrackPageViews` hook for route changes |
93
- | **Server Scripts** | `GtmScripts` component for SSR |
94
- | **React Router v6** | Uses Remix's routing system |
95
- | **TypeScript** | Full type definitions included |
96
- | **Consent Mode v2** | Built-in GDPR compliance |
93
+ | **Server Scripts** | `GtmScripts` component for SSR |
94
+ | **React Router v6** | Uses Remix's routing system |
95
+ | **TypeScript** | Full type definitions included |
96
+ | **Consent Mode v2** | Built-in GDPR compliance |
97
97
 
98
98
  ---
99
99
 
@@ -104,14 +104,14 @@ export default function ProductPage() {
104
104
  Server-side component that renders GTM script tags. Place in your document head.
105
105
 
106
106
  ```tsx
107
- import { GtmScripts } from '@react-gtm-kit/remix';
107
+ import { GtmScripts } from '@jwiedeman/gtm-kit-remix';
108
108
 
109
109
  <GtmScripts
110
110
  containers="GTM-XXXXXX"
111
- host="https://www.googletagmanager.com" // optional
112
- dataLayerName="dataLayer" // optional
113
- scriptAttributes={{ nonce: '...' }} // optional: CSP
114
- />
111
+ host="https://www.googletagmanager.com" // optional
112
+ dataLayerName="dataLayer" // optional
113
+ scriptAttributes={{ nonce: '...' }} // optional: CSP
114
+ />;
115
115
  ```
116
116
 
117
117
  ### `<GtmProvider />`
@@ -119,7 +119,7 @@ import { GtmScripts } from '@react-gtm-kit/remix';
119
119
  Client-side provider that manages GTM state and provides context.
120
120
 
121
121
  ```tsx
122
- import { GtmProvider } from '@react-gtm-kit/remix';
122
+ import { GtmProvider } from '@jwiedeman/gtm-kit-remix';
123
123
 
124
124
  <GtmProvider
125
125
  config={{ containers: 'GTM-XXXXXX' }}
@@ -131,7 +131,7 @@ import { GtmProvider } from '@react-gtm-kit/remix';
131
131
  }}
132
132
  >
133
133
  {children}
134
- </GtmProvider>
134
+ </GtmProvider>;
135
135
  ```
136
136
 
137
137
  ---
@@ -143,14 +143,15 @@ import { GtmProvider } from '@react-gtm-kit/remix';
143
143
  Automatically tracks page views on route changes.
144
144
 
145
145
  ```tsx
146
- import { useTrackPageViews } from '@react-gtm-kit/remix';
146
+ import { useTrackPageViews } from '@jwiedeman/gtm-kit-remix';
147
147
 
148
148
  function PageViewTracker() {
149
149
  useTrackPageViews({
150
- eventName: 'page_view', // default
151
- trackInitialPageView: true, // default
150
+ eventName: 'page_view', // default
151
+ trackInitialPageView: true, // default
152
152
  customData: { app_version: '1.0' }, // optional
153
- transformEvent: (data) => ({ // optional
153
+ transformEvent: (data) => ({
154
+ // optional
154
155
  ...data,
155
156
  user_id: getCurrentUserId()
156
157
  })
@@ -165,16 +166,12 @@ function PageViewTracker() {
165
166
  Get the push function for sending events.
166
167
 
167
168
  ```tsx
168
- import { useGtmPush } from '@react-gtm-kit/remix';
169
+ import { useGtmPush } from '@jwiedeman/gtm-kit-remix';
169
170
 
170
171
  function MyComponent() {
171
172
  const push = useGtmPush();
172
173
 
173
- return (
174
- <button onClick={() => push({ event: 'click', button: 'cta' })}>
175
- Click Me
176
- </button>
177
- );
174
+ return <button onClick={() => push({ event: 'click', button: 'cta' })}>Click Me</button>;
178
175
  }
179
176
  ```
180
177
 
@@ -183,7 +180,7 @@ function MyComponent() {
183
180
  Get the full GTM context.
184
181
 
185
182
  ```tsx
186
- import { useGtm } from '@react-gtm-kit/remix';
183
+ import { useGtm } from '@jwiedeman/gtm-kit-remix';
187
184
 
188
185
  function MyComponent() {
189
186
  const { push, client, updateConsent } = useGtm();
@@ -197,16 +194,12 @@ function MyComponent() {
197
194
  Access consent management functions.
198
195
 
199
196
  ```tsx
200
- import { useGtmConsent } from '@react-gtm-kit/remix';
197
+ import { useGtmConsent } from '@jwiedeman/gtm-kit-remix';
201
198
 
202
199
  function CookieBanner() {
203
200
  const { updateConsent } = useGtmConsent();
204
201
 
205
- return (
206
- <button onClick={() => updateConsent({ analytics_storage: 'granted' })}>
207
- Accept
208
- </button>
209
- );
202
+ return <button onClick={() => updateConsent({ analytics_storage: 'granted' })}>Accept</button>;
210
203
  }
211
204
  ```
212
205
 
@@ -224,8 +217,8 @@ Get a function that resolves when GTM is loaded.
224
217
 
225
218
  ```tsx
226
219
  // app/root.tsx
227
- import { GtmProvider, GtmScripts, useGtmConsent } from '@react-gtm-kit/remix';
228
- import { consentPresets } from '@react-gtm-kit/core';
220
+ import { GtmProvider, GtmScripts, useGtmConsent } from '@jwiedeman/gtm-kit-remix';
221
+ import { consentPresets } from '@jwiedeman/gtm-kit';
229
222
 
230
223
  function CookieBanner() {
231
224
  const { updateConsent } = useGtmConsent();
@@ -233,20 +226,28 @@ function CookieBanner() {
233
226
  return (
234
227
  <div className="cookie-banner">
235
228
  <p>We use cookies to improve your experience.</p>
236
- <button onClick={() => updateConsent({
237
- ad_storage: 'granted',
238
- analytics_storage: 'granted',
239
- ad_user_data: 'granted',
240
- ad_personalization: 'granted'
241
- })}>
229
+ <button
230
+ onClick={() =>
231
+ updateConsent({
232
+ ad_storage: 'granted',
233
+ analytics_storage: 'granted',
234
+ ad_user_data: 'granted',
235
+ ad_personalization: 'granted'
236
+ })
237
+ }
238
+ >
242
239
  Accept All
243
240
  </button>
244
- <button onClick={() => updateConsent({
245
- ad_storage: 'denied',
246
- analytics_storage: 'denied',
247
- ad_user_data: 'denied',
248
- ad_personalization: 'denied'
249
- })}>
241
+ <button
242
+ onClick={() =>
243
+ updateConsent({
244
+ ad_storage: 'denied',
245
+ analytics_storage: 'denied',
246
+ ad_user_data: 'denied',
247
+ ad_personalization: 'denied'
248
+ })
249
+ }
250
+ >
250
251
  Reject All
251
252
  </button>
252
253
  </div>
@@ -284,7 +285,7 @@ For strict CSP configurations, generate and pass a nonce:
284
285
 
285
286
  ```tsx
286
287
  // app/root.tsx
287
- import { GtmScripts } from '@react-gtm-kit/remix';
288
+ import { GtmScripts } from '@jwiedeman/gtm-kit-remix';
288
289
 
289
290
  export async function loader() {
290
291
  const nonce = generateNonce(); // Your nonce generation
@@ -297,14 +298,9 @@ export default function App() {
297
298
  return (
298
299
  <html>
299
300
  <head>
300
- <GtmScripts
301
- containers="GTM-XXXXXX"
302
- scriptAttributes={{ nonce }}
303
- />
301
+ <GtmScripts containers="GTM-XXXXXX" scriptAttributes={{ nonce }} />
304
302
  </head>
305
- <body>
306
- {/* ... */}
307
- </body>
303
+ <body>{/* ... */}</body>
308
304
  </html>
309
305
  );
310
306
  }
@@ -340,20 +336,9 @@ export default function App() {
340
336
 
341
337
  ```tsx
342
338
  // app/root.tsx
343
- import {
344
- Links,
345
- Meta,
346
- Outlet,
347
- Scripts,
348
- ScrollRestoration,
349
- } from "@remix-run/react";
350
- import {
351
- GtmProvider,
352
- GtmScripts,
353
- useTrackPageViews,
354
- useGtmConsent
355
- } from '@react-gtm-kit/remix';
356
- import { consentPresets } from '@react-gtm-kit/core';
339
+ import { Links, Meta, Outlet, Scripts, ScrollRestoration } from '@remix-run/react';
340
+ import { GtmProvider, GtmScripts, useTrackPageViews, useGtmConsent } from '@jwiedeman/gtm-kit-remix';
341
+ import { consentPresets } from '@jwiedeman/gtm-kit';
357
342
 
358
343
  const GTM_ID = 'GTM-XXXXXX';
359
344
 
@@ -371,21 +356,25 @@ function CookieBanner() {
371
356
  <p>We use cookies to improve your experience.</p>
372
357
  <div className="space-x-2">
373
358
  <button
374
- onClick={() => updateConsent({
375
- ad_storage: 'granted',
376
- analytics_storage: 'granted',
377
- ad_user_data: 'granted',
378
- ad_personalization: 'granted'
379
- })}
359
+ onClick={() =>
360
+ updateConsent({
361
+ ad_storage: 'granted',
362
+ analytics_storage: 'granted',
363
+ ad_user_data: 'granted',
364
+ ad_personalization: 'granted'
365
+ })
366
+ }
380
367
  className="bg-blue-500 px-4 py-2 rounded"
381
368
  >
382
369
  Accept All
383
370
  </button>
384
371
  <button
385
- onClick={() => updateConsent({
386
- ad_storage: 'denied',
387
- analytics_storage: 'denied'
388
- })}
372
+ onClick={() =>
373
+ updateConsent({
374
+ ad_storage: 'denied',
375
+ analytics_storage: 'denied'
376
+ })
377
+ }
389
378
  className="bg-gray-600 px-4 py-2 rounded"
390
379
  >
391
380
  Reject
@@ -431,7 +420,7 @@ export default function App() {
431
420
 
432
421
  - Remix 2.0+
433
422
  - React 18+
434
- - `@react-gtm-kit/core` (peer dependency)
423
+ - `@jwiedeman/gtm-kit` (peer dependency)
435
424
 
436
425
  ---
437
426
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jwiedeman/gtm-kit-remix",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Remix adapter for GTM Kit - Google Tag Manager integration with route tracking.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,7 +40,7 @@
40
40
  "typecheck": "tsc --noEmit"
41
41
  },
42
42
  "dependencies": {
43
- "@jwiedeman/gtm-kit": "^1.1.2"
43
+ "@jwiedeman/gtm-kit": "^1.1.3"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@remix-run/react": "^2.0.0",