sendShopifyAnalytics
Sends analytics to Shopify.
Set user and session cookies and refresh the expiry time. If is false, no analytics event will happen.
- Anchor to eventeventeventShopifyAnalyticsShopifyAnalyticsrequiredrequired
The analytics event.
- Anchor to shopDomainshopDomainshopDomainstringstring
The Online Store domain to sent Shopify analytics under the same top level domain.
ShopifyAnalytics
ShopifyPageView | ShopifyAddToCartShopifyPageView
- eventName
Use `AnalyticsEventName.PAGE_VIEW` constant.
string - payload
ShopifyPageViewPayload
ShopifyPageViewPayload
- acceptedLanguage
Language displayed to buyer.
LanguageCode - analyticsAllowed
Result of `customerPrivacyApi.analyticsProcessingAllowed()`
boolean - assetVersionId
NPM package version of either hydrogen or hydrogen-react. Defaults to hydrogen-react package version.
string - canonicalUrl
Canonical url.
string - collectionHandle
Shopify collection handle.
string - collectionId
Shopify collection id.
string - currency
Currency code.
CurrencyCode - customerId
Shopify customer id in the form of `gid://shopify/Customer/<id>`.
string - hasUserConsent
If we have consent from buyer for data collection
boolean - hydrogenSubchannelId
Alternative name for Shopify storefront id generated by Hydrogen sales channel. The value of env.PUBLIC_STOREFRONT_ID.
string - marketingAllowed
Result of `customerPrivacyApi.marketingAllowed()`
boolean - navigationApi
Navigation api: `'PerformanceNavigationTiming' | 'performance.navigation'`. Use `getClientBrowserParameters()` to collect this value.
string - navigationType
Navigation type: `'navigate' | 'reload' | 'back_forward' | 'prerender' | 'unknown'`. Use `getClientBrowserParameters()` to collect this value.
string - pageType
Shopify page type.
string - path
Value of `window.location.pathname`. Use `getClientBrowserParameters()` to collect this value.
string - products
Product list.
ShopifyAnalyticsProduct[] - referrer
Value of `window.document.referrer`. Use `getClientBrowserParameters()` to collect this value.
string - resourceId
Shopify resource id in the form of `gid://shopify/<type>/<id>`.
string - saleOfDataAllowed
Result of `customerPrivacyApi.saleOfDataAllowed()`
boolean - search
Value of `window.location.search`. Use `getClientBrowserParameters()` to collect this value.
string - searchString
Search term used on a search results page.
string - shopId
Shopify shop id in the form of `gid://shopify/Shop/<id>`.
string - shopifySalesChannel
Shopify sales channel.
ShopifySalesChannels - storefrontId
Shopify storefront id generated by Hydrogen sales channel. The value of env.PUBLIC_STOREFRONT_ID.
string - title
Value of `document.title`. Use `getClientBrowserParameters()` to collect this value.
string - totalValue
Total value of products.
number - uniqueToken
Shopify unique user token: Value of `_shopify_y` cookie. Use `getClientBrowserParameters()` to collect this value.
string - url
Value of `window.location.href`. Use `getClientBrowserParameters()` to collect this value.
string - userAgent
Value of `navigator.userAgent`. Use `getClientBrowserParameters()` to collect this value.
string - visitToken
Shopify session token: Value of `_shopify_s` cookie. Use `getClientBrowserParameters()` to collect this value.
string
CurrencyCode
Supports CurrencyCode from both Storefront API and Customer Account API. The APIs may have different CurrencyCode enums (e.g., Customer Account API added USDC in 2025-10, but Storefront API doesn't support USDC in 2025-10). This union type ensures useMoney works with data from either API.
StorefrontApiCurrencyCode | CustomerAccountApiCurrencyCodeShopifyAnalyticsProduct
- brand
Product brand or vendor.
string - category
Product category or type.
string - name
Product name.
string - price
Product price.
string - productGid
Product id in the form of `gid://shopify/Product/<id>`.
string - quantity
Quantity of the product in this event.
number - sku
Product sku.
string - variantGid
Variant id in the form of `gid://shopify/ProductVariant/<id>`.
string - variantName
Variant name.
string
ShopifySalesChannels
keyof typeof ShopifySalesChannelShopifySalesChannel
Analytics sales channel values accepted by Shopify analytics.
- headless
Shopify Headless sales channel
'headless' - hydrogen
Shopify Hydrogen sales channel
'hydrogen'
ShopifyAddToCart
- eventName
Use `AnalyticsEventName.ADD_TO_CART` constant.
string - payload
ShopifyAddToCartPayload
ShopifyAddToCartPayload
- acceptedLanguage
Language displayed to buyer.
LanguageCode - analyticsAllowed
Result of `customerPrivacyApi.analyticsProcessingAllowed()`
boolean - assetVersionId
NPM package version of either hydrogen or hydrogen-react. Defaults to hydrogen-react package version.
string - cartId
Shopify cart id in the form of `gid://shopify/Cart/<id>`.
string - currency
Currency code.
CurrencyCode - customerId
Shopify customer id in the form of `gid://shopify/Customer/<id>`.
string - hasUserConsent
If we have consent from buyer for data collection
boolean - hydrogenSubchannelId
Alternative name for Shopify storefront id generated by Hydrogen sales channel. The value of env.PUBLIC_STOREFRONT_ID.
string - marketingAllowed
Result of `customerPrivacyApi.marketingAllowed()`
boolean - navigationApi
Navigation api: `'PerformanceNavigationTiming' | 'performance.navigation'`. Use `getClientBrowserParameters()` to collect this value.
string - navigationType
Navigation type: `'navigate' | 'reload' | 'back_forward' | 'prerender' | 'unknown'`. Use `getClientBrowserParameters()` to collect this value.
string - path
Value of `window.location.pathname`. Use `getClientBrowserParameters()` to collect this value.
string - products
Product list.
ShopifyAnalyticsProduct[] - referrer
Value of `window.document.referrer`. Use `getClientBrowserParameters()` to collect this value.
string - saleOfDataAllowed
Result of `customerPrivacyApi.saleOfDataAllowed()`
boolean - search
Value of `window.location.search`. Use `getClientBrowserParameters()` to collect this value.
string - shopId
Shopify shop id in the form of `gid://shopify/Shop/<id>`.
string - shopifySalesChannel
Shopify sales channel.
ShopifySalesChannels - storefrontId
Shopify storefront id generated by Hydrogen sales channel. The value of env.PUBLIC_STOREFRONT_ID.
string - title
Value of `document.title`. Use `getClientBrowserParameters()` to collect this value.
string - totalValue
Total value of products.
number - uniqueToken
Shopify unique user token: Value of `_shopify_y` cookie. Use `getClientBrowserParameters()` to collect this value.
string - url
Value of `window.location.href`. Use `getClientBrowserParameters()` to collect this value.
string - userAgent
Value of `navigator.userAgent`. Use `getClientBrowserParameters()` to collect this value.
string - visitToken
Shopify session token: Value of `_shopify_s` cookie. Use `getClientBrowserParameters()` to collect this value.
string
Anchor to analyticseventnameAnalyticsEventName
Analytics event names accepted by Shopify analytics.
- Anchor to ADD_TO_CARTADD_TO_CARTADD_TO_CART'ADD_TO_CART''ADD_TO_CART'requiredrequired
Add to cart
- Anchor to PAGE_VIEWPAGE_VIEWPAGE_VIEW'PAGE_VIEW''PAGE_VIEW'requiredrequired
Page view
Anchor to analyticspagetypeAnalyticsPageType
Analytics page type values accepted by Shopify analytics.
- Anchor to articlearticlearticle'article''article'requiredrequired
- Anchor to blogblogblog'blog''blog'requiredrequired
- Anchor to captchacaptchacaptcha'captcha''captcha'requiredrequired
- Anchor to cartcartcart'cart''cart'requiredrequired
- Anchor to collectioncollectioncollection'collection''collection'requiredrequired
- Anchor to customersAccountcustomersAccountcustomersAccount'customers/account''customers/account'requiredrequired
- Anchor to customersActivateAccountcustomersActivateAccountcustomersActivateAccount'customers/activate_account''customers/activate_account'requiredrequired
- Anchor to customersAddressescustomersAddressescustomersAddresses'customers/addresses''customers/addresses'requiredrequired
- Anchor to customersLogincustomersLogincustomersLogin'customers/login''customers/login'requiredrequired
- Anchor to customersOrdercustomersOrdercustomersOrder'customers/order''customers/order'requiredrequired
- Anchor to customersRegistercustomersRegistercustomersRegister'customers/register''customers/register'requiredrequired
- Anchor to customersResetPasswordcustomersResetPasswordcustomersResetPassword'customers/reset_password''customers/reset_password'requiredrequired
- Anchor to forbiddenforbiddenforbidden'403''403'requiredrequired
- Anchor to giftCardgiftCardgiftCard'gift_card''gift_card'requiredrequired
- Anchor to homehomehome'index''index'requiredrequired
- Anchor to listCollectionslistCollectionslistCollections'list-collections''list-collections'requiredrequired
- Anchor to notFoundnotFoundnotFound'404''404'requiredrequired
- Anchor to pagepagepage'page''page'requiredrequired
- Anchor to passwordpasswordpassword'password''password'requiredrequired
- Anchor to policypolicypolicy'policy''policy'requiredrequired
- Anchor to productproductproduct'product''product'requiredrequired
- Anchor to searchsearchsearch'search''search'requiredrequired
Anchor to shopifysaleschannelShopifySalesChannel
Analytics sales channel values accepted by Shopify analytics.
- Anchor to headlessheadlessheadless'headless''headless'requiredrequired
Shopify Headless sales channel
- Anchor to hydrogenhydrogenhydrogen'hydrogen''hydrogen'requiredrequired
Shopify Hydrogen sales channel