Hydrogen event reference
Hydrogen (headless) · Reference

Hydrogen event reference

Events fired by @pixelrelay/hydrogen and where they go. Each event can leave your storefront two ways: from PixelRelay's servers, and from a browser tag. The tables show both.

Storefront events

Sent from PixelRelay's servers

A dash means nothing is sent for that platform.

Platformpage_viewedproduct_viewedcart_viewedcollection_viewedsearch_submittedproduct_added_to_cartproduct_removed_from_cart
GA4page_view ¹view_itemview_cartview_item_listsearchadd_to_cartremove_from_cart
MetaPageView ²ViewContentViewContent–SearchAddToCart–
TikTok–ViewContentViewContent–SearchAddToCart–
Pinterestpage_visit ²view_content–view_categorysearchadd_to_cart–
SnapchatPAGE_VIEW ²VIEW_CONTENTVIEW_CONTENT–SEARCHADD_CART–
Reddit–ViewContent––SearchAddToCart–
Microsoft Ads–view_item––searchadd_to_cart–
Klaviyo–Viewed ProductViewed Cart––Added to Cart–
Segmentpage_viewed ²Product ViewedCart Viewedcollection_viewedProducts SearchedProduct Addedproduct_removed_from_cart
Google Ads ³page_viewview_item––searchadd_to_cart–

LinkedIn only receives purchases.

¹ GA4's own browser tag sends page views. PixelRelay's server copy is only sent when that tag is blocked or failed to configure, and only if Track page views server-side is on.

² Only sent if Track page views server-side is on (Settings → Relay, Pro or higher, off by default).

³ Google Ads browse uploads are off by default (Settings → Google Ads → Browse event uploads). The browser tag sends these events instead.

Segment names that aren't Segment spec names are the raw PixelRelay event name.

Sent from the browser tag

PlatformEventsNotes
MetaPageView, ViewContent (product and cart), Search, AddToCartShares an event ID with the server copy
TikTokPageView, ViewContent (product and cart), Search, AddToCartShares an event ID with the server copy
GA4page_viewPage views only. The other GA4 events come from the server
KlaviyoActive on Site, Viewed Product, Added to CartOnsite tracking
Google Adspage_view, view_item, add_to_cart, searchOnly for events that have a conversion action mapped
RedditPageVisitFires when the tag loads
Snapchat, Microsoft Ads–The tag loads to set cookies only

Browser tags need the CSP change from the quickstart.

How each event fires

  • page_viewed: every client-side route change. Source is Hydrogen's PAGE_VIEWED bus event, or a useLocation fallback when the bus is blocked.
  • product_viewed: when you render <Analytics.ProductView>.
  • product_added_to_cart: use useTrackAddToCart() on your button's onClick. It works with ad blockers. Hydrogen's PRODUCT_ADD_TO_CART bus event is the fallback and only fires while the bus is alive.
  • product_removed_from_cart: from the analytics bus when a line is reduced or removed.
  • cart_viewed: needs <Analytics.CartView>.
  • collection_viewed: needs <Analytics.CollectionView>.
  • search_submitted: needs <Analytics.SearchView>.

Checkout and purchase

Hydrogen sends no storefront conversion for these. Call useTrackCheckout(cart) before following the checkout URL so attribution lands on the cart. Shopify's checkout and the order webhook take over from there.

EventSource
checkout_startedPixelRelay's Web Pixel in Shopify checkout
payment_info_submittedWeb Pixel
checkout_completed / order_placedOrder webhook. This is the source of truth for purchases

PixelRelay won't send the same order twice, but it can't merge with a copy sent by another tool. See Conversions counted twice.

Browser dispatch outcomes

Meta, TikTok, Klaviyo, GA4 and Google Ads have browser adapters. Each reports what its own attempt did.

OutcomeMeaning
sentHanded to the vendor tag
blockedThe vendor tag couldn't be reached. Usually an ad blocker or your CSP
config_failedThe tag loaded but the destination was never configured
consent_deniedThe shopper's consent choice stopped that platform
unsupportedThat platform doesn't accept this event

This records the attempt, not whether the vendor accepted it, and it never stops the server copy. In the merchant event log, only Google Ads shows this today. See Check delivery in the event log.

Custom events

import { useTrackEvent } from '@pixelrelay/hydrogen';

const track = useTrackEvent();
track('lead', { email: user.email });

Custom events go to GA4 and Segment only. GA4 gets the event name and event ID, without your properties. Segment gets your properties as event properties. An email is never sent raw. It's only used to make Segment's hashed userId.

For purchase-class events you must pass payload.orderId. Purchases without one are dropped, because the order webhook is the source of truth for purchases.

Attribution signals

Sent with every event when available.

FieldSource
fbp, fbcMeta cookies, or fbclid in the URL
ttclid, ttpTikTok
gclid, gbraid, wbraidGoogle Ads, including the iOS click IDs
msclkidMicrosoft Ads
scid, sccidSnapchat cookie and ScCid click ID
epikPinterest
rdt_cidReddit
li_fat_idLinkedIn
gaClientId, gaSessionIdGA4 _ga and _ga_<container> cookies
durableId_relay_uid, a first-party cookie kept for 365 days
consentStateShopify's Customer Privacy API
eventSourceUrlCurrent page URL

Cookie-based signals depend on the vendor tags loading, which needs the CSP step from the quickstart. Signals read from URL parameters don't. When a visitor declines consent, the matching signals are removed. See Privacy & consent.

<PixelRelayProvider> props

PropRequiredDescription
shopYesstore.myshopify.com
proxyUrlNoFirst-party POST URL. Defaults to /api/pixel for 1.x compatibility. New installs pass /api/relay
autoConfigNoFetch connected pixel IDs and Ads labels through the proxy. Defaults to true
customerNoSigned-in shopper, for Klaviyo identify and reset. Pass null on logout
scriptsNoOverride the fetched pixel IDs
storefrontApiUrlNoStorefront GraphQL endpoint. Needed to write cart attributes
storefrontTokenNoPublic Storefront token. Needed to write cart attributes
cartIdNoCart GID, if you write attributes from the provider instead of <PixelRelayCartAttributes>
debugNoVerbose console logging. Also switchable with localStorage.setItem('pixelrelay:debug', '1')

Need help? Email [email protected]