@graphcommerce/googleanalytics 5.2.0-canary.8 → 6.0.0-canary.20

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,29 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.0.0-canary.20
4
+
5
+ ## 5.2.0-canary.19
6
+
7
+ ## 5.2.0-canary.18
8
+
9
+ ## 5.2.0-canary.17
10
+
11
+ ## 5.2.0-canary.16
12
+
13
+ ## 5.2.0-canary.15
14
+
15
+ ## 5.2.0-canary.14
16
+
17
+ ## 5.2.0-canary.13
18
+
19
+ ## 5.2.0-canary.12
20
+
21
+ ## 5.2.0-canary.11
22
+
23
+ ## 5.2.0-canary.10
24
+
25
+ ## 5.2.0-canary.9
26
+
3
27
  ## 5.2.0-canary.8
4
28
 
5
29
  ## 5.2.0-canary.7
@@ -0,0 +1,19 @@
1
+ extend input GraphCommerceI18nConfig {
2
+ """
3
+ Configure different Google Analytics IDs for different locales.
4
+
5
+ To disable for a specific locale, set the value to null.
6
+ """
7
+ googleAnalyticsId: String
8
+ }
9
+
10
+ extend input GraphCommerceConfig {
11
+ """
12
+ See https://support.google.com/analytics/answer/9539598?hl=en
13
+
14
+ Provide a value to enable Google Analytics for your store.
15
+
16
+ To enable only for a specific locale, override the value in the i18n config.
17
+ """
18
+ googleAnalyticsId: String
19
+ }
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # @graphcommerce/googleanalytics
1
+ # @graphcommerce/googleanalytics ([Config](./Config.graphqls))
2
2
 
3
3
  This package makes it easy to add Google Analytics GA4 to your GraphCommerce
4
4
  webshop.
@@ -13,19 +13,7 @@ Besides the GA4 integration it also tracks the following events:
13
13
  - select_item
14
14
  - view_item_list
15
15
 
16
- ### Configuration
16
+ ## Configuration
17
17
 
18
- Fill `NEXT_PUBLIC_GOOGLE_ANALYTICS` in your .env file. The value of
19
- `NEXT_PUBLIC_GOOGLE_ANALYTICS` can be string or JSON stringified object:
20
-
21
- ```
22
- # your .env file
23
-
24
- # Google Analytics v4 ID
25
- NEXT_PUBLIC_GOOGLE_ANALYTICS="G-XXXXXXXX"
26
-
27
- # or
28
-
29
- # Google Analytics v4 ID per locale
30
- NEXT_PUBLIC_GOOGLE_ANALYTICS='{"en-us": "G-XXXXXXXX", "nl-nl": "G-XXXXXXXX"}'
31
- ```
18
+ Configure the following ([configuration values](./Config.graphqls)) in your
19
+ graphcommerce.config.js
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/googleanalytics",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "5.2.0-canary.8",
5
+ "version": "6.0.0-canary.20",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,18 +12,18 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@graphcommerce/graphql-mesh": "5.2.0-canary.8",
16
- "@graphcommerce/magento-cart": "5.2.0-canary.8",
17
- "@graphcommerce/magento-cart-payment-method": "5.2.0-canary.8",
18
- "@graphcommerce/magento-cart-shipping-method": "5.2.0-canary.8",
19
- "@graphcommerce/magento-product": "5.2.0-canary.8",
20
- "@graphcommerce/next-config": "5.2.0-canary.8",
21
- "@graphcommerce/next-ui": "5.2.0-canary.8"
15
+ "@graphcommerce/graphql-mesh": "6.0.0-canary.20",
16
+ "@graphcommerce/magento-cart": "6.0.0-canary.20",
17
+ "@graphcommerce/magento-cart-payment-method": "6.0.0-canary.20",
18
+ "@graphcommerce/magento-cart-shipping-method": "6.0.0-canary.20",
19
+ "@graphcommerce/magento-product": "6.0.0-canary.20",
20
+ "@graphcommerce/next-config": "6.0.0-canary.20",
21
+ "@graphcommerce/next-ui": "6.0.0-canary.20"
22
22
  },
23
23
  "devDependencies": {
24
- "@graphcommerce/eslint-config-pwa": "5.2.0-canary.8",
25
- "@graphcommerce/prettier-config-pwa": "5.2.0-canary.8",
26
- "@graphcommerce/typescript-config-pwa": "5.2.0-canary.8",
24
+ "@graphcommerce/eslint-config-pwa": "6.0.0-canary.20",
25
+ "@graphcommerce/prettier-config-pwa": "6.0.0-canary.20",
26
+ "@graphcommerce/typescript-config-pwa": "6.0.0-canary.20",
27
27
  "@types/gtag.js": "^0.0.12"
28
28
  },
29
29
  "peerDependencies": {
@@ -1,9 +1,10 @@
1
1
  import { AddProductsToCartFormProps } from '@graphcommerce/magento-product'
2
- import { PluginProps } from '@graphcommerce/next-config'
2
+ import { IfConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { gtagAddToCart } from '../events/gtagAddToCart/gtagAddToCart'
4
4
 
5
5
  export const component = 'AddProductsToCartForm'
6
6
  export const exported = '@graphcommerce/magento-product'
7
+ export const ifConfig: IfConfig = 'googleAnalyticsId'
7
8
 
8
9
  /** When a product is added to the Cart, send a Google Analytics event */
9
10
  function GaAddProductsToCartForm(props: PluginProps<AddProductsToCartFormProps>) {
@@ -1,9 +1,10 @@
1
1
  import { CartStartCheckoutProps } from '@graphcommerce/magento-cart'
2
- import { PluginProps } from '@graphcommerce/next-config'
2
+ import { IfConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { gtagBeginCheckout } from '../events/gtagBeginCheckout/gtagBeginCheckout'
4
4
 
5
5
  export const component = 'CartStartCheckout'
6
6
  export const exported = '@graphcommerce/magento-cart'
7
+ export const ifConfig: IfConfig = 'googleAnalyticsId'
7
8
 
8
9
  export function GaCartStartCheckout(props: PluginProps<CartStartCheckoutProps>) {
9
10
  const { Prev, onStart, ...rest } = props
@@ -1,9 +1,10 @@
1
1
  import { CartStartCheckoutLinkOrButtonProps } from '@graphcommerce/magento-cart'
2
- import { PluginProps } from '@graphcommerce/next-config'
2
+ import { IfConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { gtagBeginCheckout } from '../events/gtagBeginCheckout/gtagBeginCheckout'
4
4
 
5
5
  export const component = 'CartStartCheckoutLinkOrButton'
6
6
  export const exported = '@graphcommerce/magento-cart'
7
+ export const ifConfig: IfConfig = 'googleAnalyticsId'
7
8
 
8
9
  export function GaCartStartCheckoutLinkOrButton(
9
10
  props: PluginProps<CartStartCheckoutLinkOrButtonProps>,
@@ -1,9 +1,10 @@
1
1
  import type { PagesProps } from '@graphcommerce/framer-next-pages'
2
- import type { PluginProps } from '@graphcommerce/next-config'
2
+ import type { IfConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { GoogleAnalyticsScript } from '../components/GoogleAnalyticsScript'
4
4
 
5
5
  export const component = 'FramerNextPages'
6
6
  export const exported = '@graphcommerce/framer-next-pages'
7
+ export const ifConfig: IfConfig = 'googleAnalyticsId'
7
8
 
8
9
  let warned = false
9
10
 
@@ -1,11 +1,12 @@
1
1
  import { useCartQuery } from '@graphcommerce/magento-cart'
2
2
  import { PaymentMethodButtonProps } from '@graphcommerce/magento-cart-payment-method'
3
3
  import { GetPaymentMethodContextDocument } from '@graphcommerce/magento-cart-payment-method/PaymentMethodContext/GetPaymentMethodContext.gql'
4
- import { PluginProps } from '@graphcommerce/next-config'
4
+ import { IfConfig, PluginProps } from '@graphcommerce/next-config'
5
5
  import { gtagAddPaymentInfo } from '../events/gtagAddPaymentInfo/gtagAddPaymentInfo'
6
6
 
7
7
  export const component = 'PaymentMethodButton'
8
8
  export const exported = '@graphcommerce/magento-cart-payment-method'
9
+ export const ifConfig: IfConfig = 'googleAnalyticsId'
9
10
 
10
11
  // @todo This plugin can probably be migrated to the actual form that is submitted.
11
12
  function GaPaymentMethodButton(props: PluginProps<PaymentMethodButtonProps>) {
@@ -1,9 +1,10 @@
1
1
  import type { PaymentMethodContextProviderProps } from '@graphcommerce/magento-cart-payment-method'
2
- import type { PluginProps } from '@graphcommerce/next-config'
2
+ import type { IfConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { gtagAddPurchaseInfo } from '../events/gtagAddPurchaseInfo/gtagAddPurchaseInfo'
4
4
 
5
5
  export const component = 'PaymentMethodContextProvider'
6
6
  export const exported = '@graphcommerce/magento-cart-payment-method'
7
+ export const ifConfig: IfConfig = 'googleAnalyticsId'
7
8
 
8
9
  function GaPaymentMethodContextProvider(props: PluginProps<PaymentMethodContextProviderProps>) {
9
10
  const { Prev, onSuccess, ...rest } = props
@@ -1,10 +1,11 @@
1
1
  import { ProductListItemProps } from '@graphcommerce/magento-product'
2
- import { PluginProps } from '@graphcommerce/next-config'
2
+ import { IfConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { useEventCallback } from '@mui/material'
4
4
  import { useGoogleAnalyticsListItemHandler } from '../components/GoogleAnalyticsItemList'
5
5
 
6
6
  export const component = 'ProductListItem'
7
7
  export const exported = '@graphcommerce/magento-product'
8
+ export const ifConfig: IfConfig = 'googleAnalyticsId'
8
9
 
9
10
  function GaProductListItemsBase(props: PluginProps<ProductListItemProps>) {
10
11
  const { Prev, onClick, ...rest } = props
@@ -1,9 +1,10 @@
1
1
  import type { ProductItemsGridProps } from '@graphcommerce/magento-product'
2
- import { PluginProps } from '@graphcommerce/next-config'
2
+ import { IfConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { GoogleAnalyticsItemList } from '../components/GoogleAnalyticsItemList'
4
4
 
5
5
  export const component = 'ProductListItemsBase'
6
6
  export const exported = '@graphcommerce/magento-product'
7
+ export const ifConfig: IfConfig = 'googleAnalyticsId'
7
8
 
8
9
  export function GaProductListItemsBase(props: PluginProps<ProductItemsGridProps>) {
9
10
  const { Prev, ...rest } = props
@@ -1,9 +1,10 @@
1
1
  import { ShippingMethodFormProps } from '@graphcommerce/magento-cart-shipping-method'
2
- import { PluginProps } from '@graphcommerce/next-config'
2
+ import { IfConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { gtagAddShippingInfo } from '../events/gtagAddShippingInfo/gtagAddShippingInfo'
4
4
 
5
5
  export const component = 'ShippingMethodForm'
6
6
  export const exported = '@graphcommerce/magento-cart-shipping-method'
7
+ export const ifConfig: IfConfig = 'googleAnalyticsId'
7
8
 
8
9
  /** When the ShippingMethod is submitted the result is sent to Google Analytics */
9
10
  export function GaShippingMethodForm(props: PluginProps<ShippingMethodFormProps>) {
@@ -1,9 +1,9 @@
1
- import { UpdateItemQuantityProps } from '@graphcommerce/magento-cart-items'
2
- import { PluginProps } from '@graphcommerce/next-config'
1
+ import type { UpdateItemQuantityProps } from '@graphcommerce/magento-cart-items'
2
+ import { IfConfig, PluginProps } from '@graphcommerce/next-config'
3
3
 
4
4
  export const component = 'UpdateItemQuantity'
5
5
  export const exported = '@graphcommerce/magento-cart-items/UpdateItemQuantity/UpdateItemQuantity'
6
- export const ifEnv = 'NEXT_PUBLIC_GOOGLE_ANALYTICS' // @frank: chekcen of dit werr
6
+ export const ifConfig: IfConfig = 'googleAnalyticsId'
7
7
 
8
8
  /**
9
9
  * When a product is added to the Cart, by using the + button on cart page, send a Google Analytics