@graphcommerce/googletagmanager 8.1.0-canary.9 → 9.0.0-canary.101

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/CHANGELOG.md CHANGED
@@ -1,5 +1,201 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.0.0-canary.101
4
+
5
+ ## 9.0.0-canary.100
6
+
7
+ ## 9.0.0-canary.99
8
+
9
+ ## 9.0.0-canary.98
10
+
11
+ ## 9.0.0-canary.97
12
+
13
+ ## 9.0.0-canary.96
14
+
15
+ ### Patch Changes
16
+
17
+ - [#2403](https://github.com/graphcommerce-org/graphcommerce/pull/2403) [`9f01825`](https://github.com/graphcommerce-org/graphcommerce/commit/9f01825f9f4101ed009515735b75182673d942b5) - fix: Google tag manager noscript tag would output escaped html causing hydration errors ([@FrankHarland](https://github.com/FrankHarland))
18
+
19
+ ## 9.0.0-canary.95
20
+
21
+ ## 9.0.0-canary.94
22
+
23
+ ## 9.0.0-canary.93
24
+
25
+ ## 9.0.0-canary.92
26
+
27
+ ## 9.0.0-canary.91
28
+
29
+ ## 9.0.0-canary.90
30
+
31
+ ## 9.0.0-canary.89
32
+
33
+ ## 9.0.0-canary.88
34
+
35
+ ## 9.0.0-canary.87
36
+
37
+ ## 9.0.0-canary.86
38
+
39
+ ## 9.0.0-canary.85
40
+
41
+ ## 9.0.0-canary.84
42
+
43
+ ## 9.0.0-canary.83
44
+
45
+ ## 9.0.0-canary.82
46
+
47
+ ## 9.0.0-canary.81
48
+
49
+ ## 9.0.0-canary.80
50
+
51
+ ## 9.0.0-canary.79
52
+
53
+ ## 9.0.0-canary.78
54
+
55
+ ## 9.0.0-canary.77
56
+
57
+ ## 9.0.0-canary.76
58
+
59
+ ## 9.0.0-canary.75
60
+
61
+ ## 9.0.0-canary.74
62
+
63
+ ## 9.0.0-canary.73
64
+
65
+ ## 9.0.0-canary.72
66
+
67
+ ## 9.0.0-canary.71
68
+
69
+ ## 9.0.0-canary.70
70
+
71
+ ## 9.0.0-canary.69
72
+
73
+ ## 9.0.0-canary.68
74
+
75
+ ## 9.0.0-canary.67
76
+
77
+ ## 9.0.0-canary.66
78
+
79
+ ## 9.0.0-canary.65
80
+
81
+ ## 9.0.0-canary.64
82
+
83
+ ## 9.0.0-canary.63
84
+
85
+ ## 9.0.0-canary.62
86
+
87
+ ## 9.0.0-canary.61
88
+
89
+ ## 9.0.0-canary.60
90
+
91
+ ### Patch Changes
92
+
93
+ - [#2331](https://github.com/graphcommerce-org/graphcommerce/pull/2331) [`702bfc9`](https://github.com/graphcommerce-org/graphcommerce/commit/702bfc93566c9745546988e57988431d5d4d8cb0) - Moved plugins to new format ([@paales](https://github.com/paales))
94
+
95
+ ## 9.0.0-canary.59
96
+
97
+ ## 9.0.0-canary.58
98
+
99
+ ## 9.0.0-canary.57
100
+
101
+ ## 9.0.0-canary.56
102
+
103
+ ## 9.0.0-canary.55
104
+
105
+ ## 9.0.0-canary.54
106
+
107
+ ## 8.1.0-canary.53
108
+
109
+ ## 8.1.0-canary.52
110
+
111
+ ## 8.1.0-canary.51
112
+
113
+ ## 8.1.0-canary.50
114
+
115
+ ## 8.1.0-canary.49
116
+
117
+ ### Patch Changes
118
+
119
+ - [#2317](https://github.com/graphcommerce-org/graphcommerce/pull/2317) [`2f4a61d`](https://github.com/graphcommerce-org/graphcommerce/commit/2f4a61dfee853579c96fceb5351e459aa9524a60) - Moved import locations of Google Analytics and Google Tagmanager scripts to their recommended locations ([@paales](https://github.com/paales))
120
+
121
+ ## 8.1.0-canary.48
122
+
123
+ ## 8.1.0-canary.47
124
+
125
+ ## 8.1.0-canary.46
126
+
127
+ ## 8.1.0-canary.45
128
+
129
+ ## 8.1.0-canary.44
130
+
131
+ ## 8.1.0-canary.43
132
+
133
+ ## 8.1.0-canary.42
134
+
135
+ ## 8.1.0-canary.41
136
+
137
+ ## 8.1.0-canary.40
138
+
139
+ ## 8.1.0-canary.39
140
+
141
+ ## 8.1.0-canary.38
142
+
143
+ ## 8.1.0-canary.37
144
+
145
+ ## 8.1.0-canary.36
146
+
147
+ ## 8.1.0-canary.35
148
+
149
+ ## 8.1.0-canary.34
150
+
151
+ ## 8.1.0-canary.33
152
+
153
+ ## 8.1.0-canary.32
154
+
155
+ ## 8.1.0-canary.31
156
+
157
+ ## 8.1.0-canary.30
158
+
159
+ ## 8.1.0-canary.29
160
+
161
+ ## 8.1.0-canary.28
162
+
163
+ ## 8.1.0-canary.27
164
+
165
+ ## 8.1.0-canary.26
166
+
167
+ ## 8.1.0-canary.25
168
+
169
+ ## 8.1.0-canary.24
170
+
171
+ ## 8.1.0-canary.23
172
+
173
+ ## 8.1.0-canary.22
174
+
175
+ ## 8.1.0-canary.21
176
+
177
+ ## 8.1.0-canary.20
178
+
179
+ ## 8.1.0-canary.19
180
+
181
+ ## 8.1.0-canary.18
182
+
183
+ ## 8.1.0-canary.17
184
+
185
+ ## 8.1.0-canary.16
186
+
187
+ ## 8.1.0-canary.15
188
+
189
+ ## 8.1.0-canary.14
190
+
191
+ ## 8.1.0-canary.13
192
+
193
+ ## 8.1.0-canary.12
194
+
195
+ ## 8.1.0-canary.11
196
+
197
+ ## 8.1.0-canary.10
198
+
3
199
  ## 8.1.0-canary.9
4
200
 
5
201
  ## 8.1.0-canary.8
@@ -24,8 +220,7 @@
24
220
 
25
221
  ### Patch Changes
26
222
 
27
- - [#2233](https://github.com/graphcommerce-org/graphcommerce/pull/2233) [`cabeadc`](https://github.com/graphcommerce-org/graphcommerce/commit/cabeadce2b73ce072a2fa8b8ab1ab49907cda13b) - Added core web vitals measurements to the datalayer.
28
- ([@paales](https://github.com/paales))
223
+ - [#2233](https://github.com/graphcommerce-org/graphcommerce/pull/2233) [`cabeadc`](https://github.com/graphcommerce-org/graphcommerce/commit/cabeadce2b73ce072a2fa8b8ab1ab49907cda13b) - Added core web vitals measurements to the datalayer. ([@paales](https://github.com/paales))
29
224
 
30
225
  ## 8.0.5-canary.10
31
226
 
@@ -49,8 +244,7 @@
49
244
 
50
245
  ### Patch Changes
51
246
 
52
- - [#2233](https://github.com/graphcommerce-org/graphcommerce/pull/2233) [`cabeadc`](https://github.com/graphcommerce-org/graphcommerce/commit/cabeadce2b73ce072a2fa8b8ab1ab49907cda13b) - Added core web vitals measurements to the datalayer.
53
- ([@paales](https://github.com/paales))
247
+ - [#2233](https://github.com/graphcommerce-org/graphcommerce/pull/2233) [`cabeadc`](https://github.com/graphcommerce-org/graphcommerce/commit/cabeadce2b73ce072a2fa8b8ab1ab49907cda13b) - Added core web vitals measurements to the datalayer. ([@paales](https://github.com/paales))
54
248
 
55
249
  ## 8.0.5-canary.0
56
250
 
@@ -58,15 +252,13 @@
58
252
 
59
253
  ### Patch Changes
60
254
 
61
- - [#2158](https://github.com/graphcommerce-org/graphcommerce/pull/2158) [`34de808`](https://github.com/graphcommerce-org/graphcommerce/commit/34de8085e9352d1f3b20b26746685370ea10ab90) - Extracted the datalayer from the googleanalytics package and moved to google-datalayer package. Make sure Google Analytics and Google Tagmanager both can send events individually. Be able to configure the datalayer will send as GA4 or legacy GA3 events.
62
- ([@mikekeehnen](https://github.com/mikekeehnen))
255
+ - [#2158](https://github.com/graphcommerce-org/graphcommerce/pull/2158) [`34de808`](https://github.com/graphcommerce-org/graphcommerce/commit/34de8085e9352d1f3b20b26746685370ea10ab90) - Extracted the datalayer from the googleanalytics package and moved to google-datalayer package. Make sure Google Analytics and Google Tagmanager both can send events individually. Be able to configure the datalayer will send as GA4 or legacy GA3 events. ([@mikekeehnen](https://github.com/mikekeehnen))
63
256
 
64
257
  ## 8.0.4-canary.1
65
258
 
66
259
  ### Patch Changes
67
260
 
68
- - [#2158](https://github.com/graphcommerce-org/graphcommerce/pull/2158) [`34de808`](https://github.com/graphcommerce-org/graphcommerce/commit/34de8085e9352d1f3b20b26746685370ea10ab90) - Extracted the datalayer from the googleanalytics package and moved to google-datalayer package. Make sure Google Analytics and Google Tagmanager both can send events individually. Be able to configure the datalayer will send as GA4 or legacy GA3 events.
69
- ([@mikekeehnen](https://github.com/mikekeehnen))
261
+ - [#2158](https://github.com/graphcommerce-org/graphcommerce/pull/2158) [`34de808`](https://github.com/graphcommerce-org/graphcommerce/commit/34de8085e9352d1f3b20b26746685370ea10ab90) - Extracted the datalayer from the googleanalytics package and moved to google-datalayer package. Make sure Google Analytics and Google Tagmanager both can send events individually. Be able to configure the datalayer will send as GA4 or legacy GA3 events. ([@mikekeehnen](https://github.com/mikekeehnen))
70
262
 
71
263
  ## 8.0.4-canary.0
72
264
 
@@ -112,8 +304,7 @@
112
304
 
113
305
  ### Minor Changes
114
306
 
115
- - [#2127](https://github.com/graphcommerce-org/graphcommerce/pull/2127) [`124e6c9`](https://github.com/graphcommerce-org/graphcommerce/commit/124e6c92aa3b4b77f54235f0682c38438fd619b6) - Made all Magento dependencies optional in the `googleanalytics` and `googletagmanager` packages, allowing it to be installed in any project.
116
- ([@Jessevdpoel](https://github.com/Jessevdpoel))
307
+ - [#2127](https://github.com/graphcommerce-org/graphcommerce/pull/2127) [`124e6c9`](https://github.com/graphcommerce-org/graphcommerce/commit/124e6c92aa3b4b77f54235f0682c38438fd619b6) - Made all Magento dependencies optional in the `googleanalytics` and `googletagmanager` packages, allowing it to be installed in any project. ([@Jessevdpoel](https://github.com/Jessevdpoel))
117
308
 
118
309
  ## 8.0.0-canary.100
119
310
 
package/index.ts CHANGED
@@ -1 +1 @@
1
- export * from './components'
1
+ export {}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/googletagmanager",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "8.1.0-canary.9",
5
+ "version": "9.0.0-canary.101",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,16 +12,16 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@graphcommerce/google-datalayer": "8.1.0-canary.9"
15
+ "@graphcommerce/google-datalayer": "9.0.0-canary.101"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/gapi.client.tagmanager": "^2.0.4"
19
19
  },
20
20
  "peerDependencies": {
21
- "@graphcommerce/eslint-config-pwa": "^8.1.0-canary.9",
22
- "@graphcommerce/next-ui": "^8.1.0-canary.9",
23
- "@graphcommerce/prettier-config-pwa": "^8.1.0-canary.9",
24
- "@graphcommerce/typescript-config-pwa": "^8.1.0-canary.9",
21
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.101",
22
+ "@graphcommerce/next-ui": "^9.0.0-canary.101",
23
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.101",
24
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.101",
25
25
  "@mui/material": "^5.10.16",
26
26
  "next": "*",
27
27
  "react": "^18.2.0",
@@ -1,22 +1,58 @@
1
- import type { PagesProps } from '@graphcommerce/framer-next-pages'
2
- import type { IfConfig, PluginConfig, PluginProps } from '@graphcommerce/next-config'
3
- import { GoogleTagManagerScript } from '../components/GoogleTagManagerScript'
4
-
5
- export const component = 'FramerNextPages'
6
- export const exported = '@graphcommerce/framer-next-pages'
7
- export const ifConfig: IfConfig = 'googleTagmanagerId'
1
+ /* eslint-disable react/no-danger */
2
+ /* eslint-disable @next/next/next-script-for-ga */
3
+ /* eslint-disable @next/next/no-document-import-in-page */
4
+ /* eslint-disable @next/next/no-before-interactive-script-outside-document */
5
+ import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
6
+ import { storefrontConfig } from '@graphcommerce/next-ui/server'
7
+ import type { DocumentProps } from 'next/document'
8
8
 
9
9
  export const config: PluginConfig = {
10
10
  type: 'component',
11
- module: '@graphcommerce/framer-next-pages',
11
+ module: '@graphcommerce/next-ui/server',
12
12
  ifConfig: 'googleTagmanagerId',
13
13
  }
14
14
 
15
- export function FramerNextPages(props: PluginProps<PagesProps>) {
15
+ export function DocumentBodyStart(props: PluginProps<DocumentProps>) {
16
+ const { Prev, ...rest } = props
17
+
18
+ const id =
19
+ storefrontConfig(rest.locale)?.googleTagmanagerId ??
20
+ import.meta.graphCommerce.googleTagmanagerId
21
+
22
+ if (!id) return <Prev {...rest} />
23
+
24
+ return (
25
+ <>
26
+ <noscript
27
+ dangerouslySetInnerHTML={{
28
+ __html: `<iframe src="https://www.googletagmanager.com/ns.html?id=${id}" height='0' width='0' style="display: none; visibility: hidden;"></iframe>`,
29
+ }}
30
+ />
31
+ <Prev {...rest} />
32
+ </>
33
+ )
34
+ }
35
+
36
+ export function DocumentHeadEnd(props: PluginProps<DocumentProps>) {
16
37
  const { Prev, ...rest } = props
38
+
39
+ const id =
40
+ storefrontConfig(rest.locale)?.googleTagmanagerId ??
41
+ import.meta.graphCommerce.googleTagmanagerId
42
+
17
43
  return (
18
44
  <>
19
- <GoogleTagManagerScript />
45
+ <script
46
+ dangerouslySetInnerHTML={{
47
+ __html: `
48
+ (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
49
+ new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
50
+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
51
+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
52
+ })(window,document,'script','dataLayer','${id}');
53
+ `,
54
+ }}
55
+ />
20
56
  <Prev {...rest} />
21
57
  </>
22
58
  )
@@ -1,9 +1,11 @@
1
- import { googleEventNames, sendEvent } from '@graphcommerce/google-datalayer'
2
- import type { IfConfig, MethodPlugin } from '@graphcommerce/next-config'
1
+ import { googleEventNames, type sendEvent as sendEventType } from '@graphcommerce/google-datalayer'
2
+ import type { FunctionPlugin, PluginConfig } from '@graphcommerce/next-config'
3
3
 
4
- export const func = 'sendEvent'
5
- export const exported = '@graphcommerce/google-datalayer/api/sendEvent'
6
- export const ifConfig: IfConfig = 'googleTagmanagerId'
4
+ export const config: PluginConfig = {
5
+ type: 'function',
6
+ module: '@graphcommerce/google-datalayer',
7
+ ifConfig: 'googleTagmanagerId',
8
+ }
7
9
 
8
10
  declare global {
9
11
  interface Window {
@@ -13,7 +15,7 @@ declare global {
13
15
 
14
16
  const ecommerceEvents = new RegExp(`${googleEventNames.join('|')}`, 'i')
15
17
 
16
- const tagmanagerEvent: MethodPlugin<typeof sendEvent> = (prev, eventName, eventData) => {
18
+ export const sendEvent: FunctionPlugin<typeof sendEventType> = (prev, eventName, eventData) => {
17
19
  prev(eventName, eventData)
18
20
 
19
21
  if (ecommerceEvents.test(eventName)) {
@@ -24,5 +26,3 @@ const tagmanagerEvent: MethodPlugin<typeof sendEvent> = (prev, eventName, eventD
24
26
  window.dataLayer?.push({ event: eventName, ...eventData })
25
27
  }
26
28
  }
27
-
28
- export const plugin = tagmanagerEvent
@@ -1,4 +0,0 @@
1
- /** @deprecated Not needed anymore, please use the GoogleTagManagerScript component in your _app. */
2
- export function GoogleTagManagerNoScript() {
3
- return null
4
- }
@@ -1,28 +0,0 @@
1
- import { useStorefrontConfig } from '@graphcommerce/next-ui'
2
- import Script from 'next/script'
3
-
4
- export function GoogleTagManagerScript() {
5
- const id =
6
- useStorefrontConfig().googleTagmanagerId ?? import.meta.graphCommerce.googleTagmanagerId
7
-
8
- return (
9
- <>
10
- <Script id={`gtm-${id}`} strategy='afterInteractive'>{`
11
- (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
12
- new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
13
- j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
14
- 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
15
- })(window,document,'script','dataLayer', '${id}');
16
- `}</Script>
17
- <noscript>
18
- {/* eslint-disable-next-line jsx-a11y/iframe-has-title */}
19
- <iframe
20
- src={`https://www.googletagmanager.com/ns.html?id=${id}`}
21
- height='0'
22
- width='0'
23
- style={{ display: 'none', visibility: 'hidden' }}
24
- />
25
- </noscript>
26
- </>
27
- )
28
- }
@@ -1,2 +0,0 @@
1
- export * from './GoogleTagManagerScript'
2
- export * from './GoogleTagManagerNoScript'