@graphcommerce/googletagmanager 8.1.0-canary.8 → 9.0.0-canary.54

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,102 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.0.0-canary.54
4
+
5
+ ## 8.1.0-canary.53
6
+
7
+ ## 8.1.0-canary.52
8
+
9
+ ## 8.1.0-canary.51
10
+
11
+ ## 8.1.0-canary.50
12
+
13
+ ## 8.1.0-canary.49
14
+
15
+ ### Patch Changes
16
+
17
+ - [#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
18
+ ([@paales](https://github.com/paales))
19
+
20
+ ## 8.1.0-canary.48
21
+
22
+ ## 8.1.0-canary.47
23
+
24
+ ## 8.1.0-canary.46
25
+
26
+ ## 8.1.0-canary.45
27
+
28
+ ## 8.1.0-canary.44
29
+
30
+ ## 8.1.0-canary.43
31
+
32
+ ## 8.1.0-canary.42
33
+
34
+ ## 8.1.0-canary.41
35
+
36
+ ## 8.1.0-canary.40
37
+
38
+ ## 8.1.0-canary.39
39
+
40
+ ## 8.1.0-canary.38
41
+
42
+ ## 8.1.0-canary.37
43
+
44
+ ## 8.1.0-canary.36
45
+
46
+ ## 8.1.0-canary.35
47
+
48
+ ## 8.1.0-canary.34
49
+
50
+ ## 8.1.0-canary.33
51
+
52
+ ## 8.1.0-canary.32
53
+
54
+ ## 8.1.0-canary.31
55
+
56
+ ## 8.1.0-canary.30
57
+
58
+ ## 8.1.0-canary.29
59
+
60
+ ## 8.1.0-canary.28
61
+
62
+ ## 8.1.0-canary.27
63
+
64
+ ## 8.1.0-canary.26
65
+
66
+ ## 8.1.0-canary.25
67
+
68
+ ## 8.1.0-canary.24
69
+
70
+ ## 8.1.0-canary.23
71
+
72
+ ## 8.1.0-canary.22
73
+
74
+ ## 8.1.0-canary.21
75
+
76
+ ## 8.1.0-canary.20
77
+
78
+ ## 8.1.0-canary.19
79
+
80
+ ## 8.1.0-canary.18
81
+
82
+ ## 8.1.0-canary.17
83
+
84
+ ## 8.1.0-canary.16
85
+
86
+ ## 8.1.0-canary.15
87
+
88
+ ## 8.1.0-canary.14
89
+
90
+ ## 8.1.0-canary.13
91
+
92
+ ## 8.1.0-canary.12
93
+
94
+ ## 8.1.0-canary.11
95
+
96
+ ## 8.1.0-canary.10
97
+
98
+ ## 8.1.0-canary.9
99
+
3
100
  ## 8.1.0-canary.8
4
101
 
5
102
  ## 8.1.0-canary.7
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.8",
5
+ "version": "9.0.0-canary.54",
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.8"
15
+ "@graphcommerce/google-datalayer": "9.0.0-canary.54"
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.8",
22
- "@graphcommerce/next-ui": "^8.1.0-canary.8",
23
- "@graphcommerce/prettier-config-pwa": "^8.1.0-canary.8",
24
- "@graphcommerce/typescript-config-pwa": "^8.1.0-canary.8",
21
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.54",
22
+ "@graphcommerce/next-ui": "^9.0.0-canary.54",
23
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.54",
24
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.54",
25
25
  "@mui/material": "^5.10.16",
26
26
  "next": "*",
27
27
  "react": "^18.2.0",
@@ -1,22 +1,62 @@
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
+ {/* eslint-disable-next-line jsx-a11y/iframe-has-title */}
28
+ <iframe
29
+ src={`https://www.googletagmanager.com/ns.html?id=${id}`}
30
+ height='0'
31
+ width='0'
32
+ style={{ display: 'none', visibility: 'hidden' }}
33
+ />
34
+ </noscript>
35
+ <Prev {...rest} />
36
+ </>
37
+ )
38
+ }
39
+
40
+ export function DocumentHeadEnd(props: PluginProps<DocumentProps>) {
16
41
  const { Prev, ...rest } = props
42
+
43
+ const id =
44
+ storefrontConfig(rest.locale)?.googleTagmanagerId ??
45
+ import.meta.graphCommerce.googleTagmanagerId
46
+
17
47
  return (
18
48
  <>
19
- <GoogleTagManagerScript />
49
+ <script
50
+ dangerouslySetInnerHTML={{
51
+ __html: `
52
+ (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
53
+ new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
54
+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
55
+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
56
+ })(window,document,'script','dataLayer','${id}');
57
+ `,
58
+ }}
59
+ />
20
60
  <Prev {...rest} />
21
61
  </>
22
62
  )
@@ -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'