⚠️ Developer article. This change is made in your storefront code, so it is for your development team or agency. Your team owns the integration and Measmerize can't make this change for you.
Symptoms
Your GA4 Measurement ID (format
G-XXXXXXXXXX) is set for the Size Hub, and your storefront shows the Size Hub button.No Measmerize events appear in GA4 (Realtime, DebugView or the Events report), for example
button_with_recommendation_showorpage_recommendation_view.No Measmerize requests to Google Analytics show in your browser's network tab on a product page.
Your storefront is headless (for example Hydrogen) and uses its own cookie banner, or a consent tool the Size Hub doesn't support.
If you run several stores with one GA4 property each (for example one per region), the symptom is the same on each store.
Why it happens
The Size Hub only sends analytics events after the shopper agrees to analytics cookies. Until it receives a consent choice, analytics stays off.
It reads that choice automatically from two places:
Common consent tools such as OneTrust, Cookiebot and Didomi.
Shopify's consent object, on standard Shopify themes.
On a headless storefront, neither may be available. If your banner isn't a supported consent tool and Shopify's consent object isn't on the page, the Size Hub sees no consent and keeps analytics off. Your Measurement ID is already in place. It just isn't used until consent arrives.
For the list of supported consent tools, see Privacy, Cookies, and the Perfect Fit: How Consent Impacts the Measmerize Experience.
How to fix it
Pass the shopper's choice from your own consent logic to the Size Hub, using the global object window.measmerize.
1. Call the matching function for each consent category
The shopper... | Call | What it does |
Accepts analytics cookies |
| Turns on GA4 events, including to your Measurement ID |
Accepts analytics cookies |
| Turns on Measmerize's event tracking |
Accepts functional or preference cookies |
| Remembers the shopper's measurements between visits |
Rejects or withdraws analytics consent |
| Turns the matching tracking off |
Rejects or withdraws functional consent |
| Stops remembering measurements |
2. Call them at the right time
On every product page where the Size Hub loads, with the shopper's current choice.
Again whenever the shopper changes their choice.
If window.measmerize isn't available yet when your code runs, wait for the measmerize.script.ready event on the measmerize-script element, then make the calls.
// Illustrative: replace the consent values with your own consent logic.
function applyMeasmerizeConsent({ analytics, functional }) {
if (analytics) {
window.measmerize.tracking.enableAnalytics();
window.measmerize.tracking.enableCustom();
} else {
window.measmerize.tracking.disableAnalytics();
window.measmerize.tracking.disableCustom();
}
if (functional) {
window.measmerize.cookies.enableFunctional();
} else {
window.measmerize.cookies.disableFunctional();
}
}
Check it worked
Open a product page on your storefront and accept analytics cookies in your banner.
Open your browser's network tab and look for requests to Google Analytics that carry your Measurement ID.
In GA4, open Realtime or DebugView and look for Measmerize events such as
button_with_recommendation_showandpage_recommendation_view. They show in the Events report after GA4 processes them.Reject analytics cookies, reload the page, and confirm the events stop.
Common problems
Events still don't arrive after the change: Check that the calls run on every product page, not only the first page of the session, and that they run after
window.measmerizeexists.Events arrive in the wrong property: Each store passes its own Measurement ID to the Size Hub. See Integration for Headless Storefronts for where it is set.
Events arrive but purchases show N/A or 0 in the Measmerize Analytics tab: That is a separate cause. See Purchases and sales show N/A or 0 with a custom checkout domain: how to link orders to size recommendations.
Still not working?
Email [email protected] with your store URL, the product URL you're testing, and your Measurement ID.