[{"data":1,"prerenderedAt":1829},["ShallowReactive",2],{"navigation_docs":3,"-essentials-analytics":134,"-essentials-analytics-surround":1824},[4,31,82,113],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":30},"Getting Started","i-lucide-play","\u002Fgetting-started","1.getting-started",[10,15,20,25],{"title":11,"path":12,"stem":13,"icon":14},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-home",{"title":16,"path":17,"stem":18,"icon":19},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-plug",{"title":21,"path":22,"stem":23,"icon":24},"Usage","\u002Fgetting-started\u002Fusage","1.getting-started\u002F4.usage","i-lucide-code",{"title":26,"path":27,"stem":28,"icon":29},"Editor","\u002Fgetting-started\u002Feditor","1.getting-started\u002F5.editor","i-lucide-wrench",false,{"title":32,"icon":33,"path":34,"stem":35,"children":36,"page":30},"Essentials","i-lucide-book","\u002Fessentials","2.essentials",[37,42,47,52,57,62,67,72,77],{"title":38,"path":39,"stem":40,"icon":41},"Setup Shopify","\u002Fessentials\u002Fsetup-shopify","2.essentials\u002F1.setup-shopify","i-lucide-shopping-bag",{"title":43,"path":44,"stem":45,"icon":46},"Module Config","\u002Fessentials\u002Fconfiguration","2.essentials\u002F2.configuration","i-lucide-anvil",{"title":48,"path":49,"stem":50,"icon":51},"Storefront API","\u002Fessentials\u002Fstorefront","2.essentials\u002F3.storefront","i-lucide-store",{"title":53,"path":54,"stem":55,"icon":56},"Customer API","\u002Fessentials\u002Fcustomer-account","2.essentials\u002F4.customer-account","i-lucide-user",{"title":58,"path":59,"stem":60,"icon":61},"Admin API","\u002Fessentials\u002Fadmin","2.essentials\u002F5.admin","i-lucide-shield",{"title":63,"path":64,"stem":65,"icon":66},"Error Handling","\u002Fessentials\u002Ferror-handling","2.essentials\u002F6.error-handling","i-lucide-bug",{"title":68,"path":69,"stem":70,"icon":71},"Caching","\u002Fessentials\u002Fcaching","2.essentials\u002F7.caching","i-lucide-rabbit",{"title":73,"path":74,"stem":75,"icon":76},"Codegen","\u002Fessentials\u002Fcodegen","2.essentials\u002F8.codegen","i-lucide-wand-sparkles",{"title":78,"path":79,"stem":80,"icon":81},"Analytics","\u002Fessentials\u002Fanalytics","2.essentials\u002F9.analytics","i-lucide-chart-line",{"title":83,"icon":84,"path":85,"stem":86,"children":87,"page":30},"Recipes","i-lucide-chef-hat","\u002Frecipes","3.recipes",[88,93,98,103,108],{"title":89,"path":90,"stem":91,"icon":92},"Navigation Menu","\u002Frecipes\u002Fnavigation-tree","3.recipes\u002F1.navigation-tree","i-lucide-menu",{"title":94,"path":95,"stem":96,"icon":97},"Collection Page","\u002Frecipes\u002Fcollection-page","3.recipes\u002F2.collection-page","i-lucide-group",{"title":99,"path":100,"stem":101,"icon":102},"Collection Filters","\u002Frecipes\u002Fcollection-filters","3.recipes\u002F3.collection-filters","i-lucide-funnel",{"title":104,"path":105,"stem":106,"icon":107},"Product Page","\u002Frecipes\u002Fproduct-page","3.recipes\u002F4.product-page","i-lucide-shirt",{"title":109,"path":110,"stem":111,"icon":112},"Using the Cart","\u002Frecipes\u002Fcart","3.recipes\u002F5.cart","i-lucide-shopping-cart",{"title":114,"icon":115,"path":116,"stem":117,"children":118,"page":30},"Going Further","i-lucide-pickaxe","\u002Fgoing-further","4.going-further",[119,124,129],{"title":120,"path":121,"stem":122,"icon":123},"Hooks","\u002Fgoing-further\u002Fhooks","4.going-further\u002F1.hooks","i-lucide-between-horizontal-start",{"title":125,"path":126,"stem":127,"icon":128},"GraphiQL Sandbox","\u002Fgoing-further\u002Fsandbox","4.going-further\u002F2.sandbox","i-lucide-app-window",{"title":130,"path":131,"stem":132,"icon":133},"Webhooks","\u002Fgoing-further\u002Fwebhooks","4.going-further\u002F3.webhooks","i-lucide-fishing-hook",{"id":135,"title":78,"body":136,"description":1817,"extension":1818,"links":1819,"meta":1820,"navigation":1821,"path":79,"seo":1822,"stem":80,"__hash__":1823},"docs\u002F2.essentials\u002F9.analytics.md",{"type":137,"value":138,"toc":1804},"minimark",[139,143,157,192,197,207,357,361,376,460,464,470,477,587,590,716,733,737,744,890,894,916,1063,1096,1104,1108,1111,1215,1233,1253,1257,1263,1379,1381,1390,1393,1485,1511,1515,1518,1601,1620,1793,1800],[140,141,142],"p",{},"Shopify collects analytics for headless storefronts the same way it does for themes, powering the reports and live view\nin your admin. This module wires that up for you: drop-in components and a composable cover product, collection, search,\nand cart views, add-to-cart, and consent.",[140,144,145,146,156],{},"Under the hood it uses Shopify's own ",[147,148,152],"a",{"href":149,"rel":150},"https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@shopify\u002Fhydrogen-react",[151],"nofollow",[153,154,155],"code",{},"@shopify\u002Fhydrogen-react","\nto send events, so you get the exact payloads Shopify expects without reimplementing them.",[158,159,160,166],"note",{},[140,161,162,163,165],{},"Analytics uses functionality from ",[153,164,155],{},". Install it before enabling analytics in the module:",[167,168,174],"pre",{"className":169,"code":170,"filename":171,"language":172,"meta":173,"style":173},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","npm install @shopify\u002Fhydrogen-react\n","Terminal","bash","",[153,175,176],{"__ignoreMap":173},[177,178,181,185,189],"span",{"class":179,"line":180},"line",1,[177,182,184],{"class":183},"sBMFI","npm",[177,186,188],{"class":187},"sfazB"," install",[177,190,191],{"class":187}," @shopify\u002Fhydrogen-react\n",[193,194,196],"h2",{"id":195},"getting-started","Getting started",[140,198,199,200,202,203,206],{},"Analytics is opt-in. Once ",[153,201,155],{}," is installed, you can enable it in your\n",[153,204,205],{},"nuxt.config.ts",":",[167,208,212],{"className":209,"code":210,"filename":205,"language":211,"meta":173,"style":173},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","export default defineNuxtConfig({\n  shopify: {\n    name: 'quickstart-abcd1234',\n\n    clients: {\n      storefront: {\n        publicAccessToken: '...',\n      },\n    },\n\n    analytics: true,\n  },\n})\n","ts",[153,213,214,235,247,267,274,284,294,311,317,323,328,342,348],{"__ignoreMap":173},[177,215,216,220,223,227,231],{"class":179,"line":180},[177,217,219],{"class":218},"s7zQu","export",[177,221,222],{"class":218}," default",[177,224,226],{"class":225},"s2Zo4"," defineNuxtConfig",[177,228,230],{"class":229},"sTEyZ","(",[177,232,234],{"class":233},"sMK4o","{\n",[177,236,238,242,244],{"class":179,"line":237},2,[177,239,241],{"class":240},"swJcz","  shopify",[177,243,206],{"class":233},[177,245,246],{"class":233}," {\n",[177,248,250,253,255,258,261,264],{"class":179,"line":249},3,[177,251,252],{"class":240},"    name",[177,254,206],{"class":233},[177,256,257],{"class":233}," '",[177,259,260],{"class":187},"quickstart-abcd1234",[177,262,263],{"class":233},"'",[177,265,266],{"class":233},",\n",[177,268,270],{"class":179,"line":269},4,[177,271,273],{"emptyLinePlaceholder":272},true,"\n",[177,275,277,280,282],{"class":179,"line":276},5,[177,278,279],{"class":240},"    clients",[177,281,206],{"class":233},[177,283,246],{"class":233},[177,285,287,290,292],{"class":179,"line":286},6,[177,288,289],{"class":240},"      storefront",[177,291,206],{"class":233},[177,293,246],{"class":233},[177,295,297,300,302,304,307,309],{"class":179,"line":296},7,[177,298,299],{"class":240},"        publicAccessToken",[177,301,206],{"class":233},[177,303,257],{"class":233},[177,305,306],{"class":187},"...",[177,308,263],{"class":233},[177,310,266],{"class":233},[177,312,314],{"class":179,"line":313},8,[177,315,316],{"class":233},"      },\n",[177,318,320],{"class":179,"line":319},9,[177,321,322],{"class":233},"    },\n",[177,324,326],{"class":179,"line":325},10,[177,327,273],{"emptyLinePlaceholder":272},[177,329,331,334,336,340],{"class":179,"line":330},11,[177,332,333],{"class":240},"    analytics",[177,335,206],{"class":233},[177,337,339],{"class":338},"sfNiH"," true",[177,341,266],{"class":233},[177,343,345],{"class":179,"line":344},12,[177,346,347],{"class":233},"  },\n",[177,349,351,354],{"class":179,"line":350},13,[177,352,353],{"class":233},"}",[177,355,356],{"class":229},")\n",[193,358,360],{"id":359},"configuration","Configuration",[140,362,363,364,367,368,371,372,375],{},"The ",[153,365,366],{},"analytics"," option accepts ",[153,369,370],{},"true",", ",[153,373,374],{},"false"," (default), or an object with the following settings, all optional:",[377,378,379,389,397,415,427,435,450],"field-group",{},[380,381,384,385,388],"field",{"name":382,"type":383},"storefrontId","string","Storefront ID from your Headless or Hydrogen sales channel. Attributes events to a specific storefront; without it,\nevents fall back to the default storefront (",[153,386,387],{},"0",").",[380,390,392,393,396],{"name":391,"type":383},"domain","Domain events are sent from. Defaults to ",[153,394,395],{},"\u003Cname>.myshopify.com",".",[380,398,400,401,404,405,371,407,410,411,414],{"name":399,"type":383},"shopId","Shop ID as ",[153,402,403],{},"gid:\u002F\u002Fshopify\u002FShop\u002F\u003Cid>",". The automatic shop lookup is only skipped when ",[153,406,399],{},[153,408,409],{},"currency"," and\n",[153,412,413],{},"language"," are all set.",[380,416,417,418,421,422,426],{"name":409,"type":383},"Currency code (e.g. ",[153,419,420],{},"USD","). Resolved from the Storefront API when omitted. Only the default market, see\n",[147,423,425],{"href":424},"#buyer-market","Buyer market"," for multi-market shops.",[380,428,429,430,421,433,426],{"name":413,"type":383},"Language code (e.g. ",[153,431,432],{},"EN",[147,434,425],{"href":424},[380,436,439,440,443,444,446,447,449],{"name":437,"type":438},"autoPageView","boolean","Report a ",[153,441,442],{},"page_viewed"," event on the initial load and on every client-side navigation. Defaults to ",[153,445,370],{},"; set it to\n",[153,448,374],{}," to publish page views yourself.",[380,451,454,455,459],{"name":452,"type":453},"consent","object","Customer Privacy (consent) options, see ",[147,456,458],{"href":457},"#consent","Consent"," below.",[193,461,463],{"id":462},"tracking-views","Tracking views",[140,465,466,467,469],{},"Page views are automatic — there is no component to place. The module reports one ",[153,468,442],{}," event per URL, on the\ninitial load and on every client-side navigation. Reporting waits until the shop has resolved, so the first view carries\nthe shop identifiers and still reaches subscribers registered after the module. Views are keyed on path and query, so\njumping to an anchor on the same page does not report a second view.",[140,471,472,473,476],{},"Views that Shopify understands (product, collection, search, cart) have a renderless component each. The product,\ncollection, and search components also re-report when the item they describe changes (the product, the collection,\nor the search term), which covers client-side navigation between two products. ",[153,474,475],{},"ShopifyCartView"," reports once per mount.",[167,478,483],{"className":479,"code":480,"filename":481,"language":482,"meta":173,"style":173},"language-vue shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u003Ctemplate>\n  \u003C!-- your product page -->\n\n  \u003CShopifyProductView\n    :data=\"{\n      products: [{\n        id: product.id,\n        title: product.title,\n        vendor: product.vendor,\n        price: product.selectedOrFirstAvailableVariant.price.amount,\n        variantId: product.selectedOrFirstAvailableVariant.id,\n      }],\n    }\"\n  \u002F>\n\u003C\u002Ftemplate>\n","~\u002Fapp\u002Fpages\u002Fproducts\u002F[handle].vue","vue",[153,484,485,496,502,506,514,528,533,538,543,548,553,558,563,571,577],{"__ignoreMap":173},[177,486,487,490,493],{"class":179,"line":180},[177,488,489],{"class":233},"\u003C",[177,491,492],{"class":240},"template",[177,494,495],{"class":233},">\n",[177,497,498],{"class":179,"line":237},[177,499,501],{"class":500},"sHwdD","  \u003C!-- your product page -->\n",[177,503,504],{"class":179,"line":249},[177,505,273],{"emptyLinePlaceholder":272},[177,507,508,511],{"class":179,"line":269},[177,509,510],{"class":233},"  \u003C",[177,512,513],{"class":240},"ShopifyProductView\n",[177,515,516,520,523,526],{"class":179,"line":276},[177,517,519],{"class":518},"spNyl","    :data",[177,521,522],{"class":233},"=",[177,524,525],{"class":233},"\"",[177,527,234],{"class":187},[177,529,530],{"class":179,"line":286},[177,531,532],{"class":187},"      products: [{\n",[177,534,535],{"class":179,"line":296},[177,536,537],{"class":187},"        id: product.id,\n",[177,539,540],{"class":179,"line":313},[177,541,542],{"class":187},"        title: product.title,\n",[177,544,545],{"class":179,"line":319},[177,546,547],{"class":187},"        vendor: product.vendor,\n",[177,549,550],{"class":179,"line":325},[177,551,552],{"class":187},"        price: product.selectedOrFirstAvailableVariant.price.amount,\n",[177,554,555],{"class":179,"line":330},[177,556,557],{"class":187},"        variantId: product.selectedOrFirstAvailableVariant.id,\n",[177,559,560],{"class":179,"line":344},[177,561,562],{"class":187},"      }],\n",[177,564,565,568],{"class":179,"line":350},[177,566,567],{"class":187},"    }",[177,569,570],{"class":233},"\"\n",[177,572,574],{"class":179,"line":573},14,[177,575,576],{"class":233},"  \u002F>\n",[177,578,580,583,585],{"class":179,"line":579},15,[177,581,582],{"class":233},"\u003C\u002F",[177,584,492],{"class":240},[177,586,495],{"class":233},[140,588,589],{},"The other view components follow the same shape:",[167,591,593],{"className":479,"code":592,"language":482,"meta":173,"style":173},"\u003Ctemplate>\n  \u003CShopifyCollectionView :data=\"{ collection: { id: collection.id, handle: collection.handle } }\" \u002F>\n\n  \u003CShopifySearchView :data=\"{ searchTerm: query }\" \u002F>\n\n  \u003CShopifyCartView :data=\"{ cart }\" \u002F>\n\n  \u003CShopifyCustomView event=\"newsletter_signup\" :data=\"{ source: 'footer' }\" \u002F>\n\u003C\u002Ftemplate>\n",[153,594,595,603,625,629,649,653,672,676,708],{"__ignoreMap":173},[177,596,597,599,601],{"class":179,"line":180},[177,598,489],{"class":233},[177,600,492],{"class":240},[177,602,495],{"class":233},[177,604,605,607,610,613,615,617,620,622],{"class":179,"line":237},[177,606,510],{"class":233},[177,608,609],{"class":240},"ShopifyCollectionView",[177,611,612],{"class":518}," :data",[177,614,522],{"class":233},[177,616,525],{"class":233},[177,618,619],{"class":187},"{ collection: { id: collection.id, handle: collection.handle } }",[177,621,525],{"class":233},[177,623,624],{"class":233}," \u002F>\n",[177,626,627],{"class":179,"line":249},[177,628,273],{"emptyLinePlaceholder":272},[177,630,631,633,636,638,640,642,645,647],{"class":179,"line":269},[177,632,510],{"class":233},[177,634,635],{"class":240},"ShopifySearchView",[177,637,612],{"class":518},[177,639,522],{"class":233},[177,641,525],{"class":233},[177,643,644],{"class":187},"{ searchTerm: query }",[177,646,525],{"class":233},[177,648,624],{"class":233},[177,650,651],{"class":179,"line":276},[177,652,273],{"emptyLinePlaceholder":272},[177,654,655,657,659,661,663,665,668,670],{"class":179,"line":286},[177,656,510],{"class":233},[177,658,475],{"class":240},[177,660,612],{"class":518},[177,662,522],{"class":233},[177,664,525],{"class":233},[177,666,667],{"class":187},"{ cart }",[177,669,525],{"class":233},[177,671,624],{"class":233},[177,673,674],{"class":179,"line":296},[177,675,273],{"emptyLinePlaceholder":272},[177,677,678,680,683,686,688,690,693,695,697,699,701,704,706],{"class":179,"line":313},[177,679,510],{"class":233},[177,681,682],{"class":240},"ShopifyCustomView",[177,684,685],{"class":518}," event",[177,687,522],{"class":233},[177,689,525],{"class":233},[177,691,692],{"class":187},"newsletter_signup",[177,694,525],{"class":233},[177,696,612],{"class":518},[177,698,522],{"class":233},[177,700,525],{"class":233},[177,702,703],{"class":187},"{ source: 'footer' }",[177,705,525],{"class":233},[177,707,624],{"class":233},[177,709,710,712,714],{"class":179,"line":319},[177,711,582],{"class":233},[177,713,492],{"class":240},[177,715,495],{"class":233},[140,717,718,720,721,724,725,728,729,732],{},[153,719,682],{}," prefixes the event name with ",[153,722,723],{},"custom_",", so ",[153,726,727],{},"event=\"newsletter_signup\""," is published as\n",[153,730,731],{},"custom_newsletter_signup"," (subscribe to that prefixed name). Custom events are only delivered to your own subscribers,\nnever sent to Shopify.",[193,734,736],{"id":735},"analytics-composable","Analytics composable",[140,738,739,740,743],{},"To publish events manually, use the ",[153,741,742],{},"useShopifyAnalytics()"," composable. It is safe to call anywhere, including on the server.\nWhen analytics is disabled, it returns a no-op.",[167,745,747],{"className":209,"code":746,"language":211,"meta":173,"style":173},"const analytics = useShopifyAnalytics()\n\nanalytics.publish('product_viewed', {\n  products: [\u002F* ... *\u002F]\n})\n\nconst off = analytics.subscribe('product_viewed', (payload) => {\n  \u002F\u002F payload is typed to the event\n})\n\nanalytics.canTrack() \u002F\u002F whether the visitor consented to analytics\n",[153,748,749,765,769,792,808,814,818,860,865,871,875],{"__ignoreMap":173},[177,750,751,754,757,759,762],{"class":179,"line":180},[177,752,753],{"class":518},"const",[177,755,756],{"class":229}," analytics ",[177,758,522],{"class":233},[177,760,761],{"class":225}," useShopifyAnalytics",[177,763,764],{"class":229},"()\n",[177,766,767],{"class":179,"line":237},[177,768,273],{"emptyLinePlaceholder":272},[177,770,771,773,775,778,780,782,785,787,790],{"class":179,"line":249},[177,772,366],{"class":229},[177,774,396],{"class":233},[177,776,777],{"class":225},"publish",[177,779,230],{"class":229},[177,781,263],{"class":233},[177,783,784],{"class":187},"product_viewed",[177,786,263],{"class":233},[177,788,789],{"class":233},",",[177,791,246],{"class":233},[177,793,794,797,799,802,805],{"class":179,"line":269},[177,795,796],{"class":240},"  products",[177,798,206],{"class":233},[177,800,801],{"class":229}," [",[177,803,804],{"class":500},"\u002F* ... *\u002F",[177,806,807],{"class":229},"]\n",[177,809,810,812],{"class":179,"line":276},[177,811,353],{"class":233},[177,813,356],{"class":229},[177,815,816],{"class":179,"line":286},[177,817,273],{"emptyLinePlaceholder":272},[177,819,820,822,825,827,830,832,835,837,839,841,843,845,848,852,855,858],{"class":179,"line":296},[177,821,753],{"class":518},[177,823,824],{"class":229}," off ",[177,826,522],{"class":233},[177,828,829],{"class":229}," analytics",[177,831,396],{"class":233},[177,833,834],{"class":225},"subscribe",[177,836,230],{"class":229},[177,838,263],{"class":233},[177,840,784],{"class":187},[177,842,263],{"class":233},[177,844,789],{"class":233},[177,846,847],{"class":233}," (",[177,849,851],{"class":850},"sHdIc","payload",[177,853,854],{"class":233},")",[177,856,857],{"class":518}," =>",[177,859,246],{"class":233},[177,861,862],{"class":179,"line":313},[177,863,864],{"class":500},"  \u002F\u002F payload is typed to the event\n",[177,866,867,869],{"class":179,"line":319},[177,868,353],{"class":233},[177,870,356],{"class":229},[177,872,873],{"class":179,"line":325},[177,874,273],{"emptyLinePlaceholder":272},[177,876,877,879,881,884,887],{"class":179,"line":330},[177,878,366],{"class":229},[177,880,396],{"class":233},[177,882,883],{"class":225},"canTrack",[177,885,886],{"class":229},"() ",[177,888,889],{"class":500},"\u002F\u002F whether the visitor consented to analytics\n",[891,892,425],"h3",{"id":893},"buyer-market",[140,895,896,897,901,902,905,906,909,910,913,914,206],{},"Events carry the currency and language of the market they happened in. By default that is your shop's ",[898,899,900],"em",{},"default"," market.\nIf you want to change which market the buyer is in so it re-resolves the shop with Shopify's ",[153,903,904],{},"@inContext"," directive, call ",[153,907,908],{},"setShopContext"," with a ",[153,911,912],{},"country"," and\u002For ",[153,915,413],{},[167,917,920],{"className":209,"code":918,"filename":919,"language":211,"meta":173,"style":173},"export default defineNuxtPlugin(() => {\n  const analytics = useShopifyAnalytics()\n  const { locale } = useI18n()\n\n  watch(locale, () => analytics.setShopContext({\n    country: 'CA',\n    language: 'EN'\n  }), { immediate: true })\n})\n","~\u002Fapp\u002Fplugins\u002Fanalytics-market.client.ts",[153,921,922,940,954,974,978,1005,1021,1035,1057],{"__ignoreMap":173},[177,923,924,926,928,931,933,936,938],{"class":179,"line":180},[177,925,219],{"class":218},[177,927,222],{"class":218},[177,929,930],{"class":225}," defineNuxtPlugin",[177,932,230],{"class":229},[177,934,935],{"class":233},"()",[177,937,857],{"class":518},[177,939,246],{"class":233},[177,941,942,945,947,950,952],{"class":179,"line":237},[177,943,944],{"class":518},"  const",[177,946,829],{"class":229},[177,948,949],{"class":233}," =",[177,951,761],{"class":225},[177,953,764],{"class":240},[177,955,956,958,961,964,967,969,972],{"class":179,"line":249},[177,957,944],{"class":518},[177,959,960],{"class":233}," {",[177,962,963],{"class":229}," locale",[177,965,966],{"class":233}," }",[177,968,949],{"class":233},[177,970,971],{"class":225}," useI18n",[177,973,764],{"class":240},[177,975,976],{"class":179,"line":269},[177,977,273],{"emptyLinePlaceholder":272},[177,979,980,983,985,988,990,993,995,997,999,1001,1003],{"class":179,"line":276},[177,981,982],{"class":225},"  watch",[177,984,230],{"class":240},[177,986,987],{"class":229},"locale",[177,989,789],{"class":233},[177,991,992],{"class":233}," ()",[177,994,857],{"class":518},[177,996,829],{"class":229},[177,998,396],{"class":233},[177,1000,908],{"class":225},[177,1002,230],{"class":240},[177,1004,234],{"class":233},[177,1006,1007,1010,1012,1014,1017,1019],{"class":179,"line":286},[177,1008,1009],{"class":240},"    country",[177,1011,206],{"class":233},[177,1013,257],{"class":233},[177,1015,1016],{"class":187},"CA",[177,1018,263],{"class":233},[177,1020,266],{"class":233},[177,1022,1023,1026,1028,1030,1032],{"class":179,"line":296},[177,1024,1025],{"class":240},"    language",[177,1027,206],{"class":233},[177,1029,257],{"class":233},[177,1031,432],{"class":187},[177,1033,1034],{"class":233},"'\n",[177,1036,1037,1040,1042,1044,1046,1049,1051,1053,1055],{"class":179,"line":313},[177,1038,1039],{"class":233},"  }",[177,1041,854],{"class":240},[177,1043,789],{"class":233},[177,1045,960],{"class":233},[177,1047,1048],{"class":240}," immediate",[177,1050,206],{"class":233},[177,1052,339],{"class":338},[177,1054,966],{"class":233},[177,1056,356],{"class":240},[177,1058,1059,1061],{"class":179,"line":319},[177,1060,353],{"class":233},[177,1062,356],{"class":229},[140,1064,1065,1066,1069,1070,1073,1074,1076,1077,847,1080,371,1082,1085,1086,1076,1088,847,1090,371,1092,1095],{},"Both values are optional and are upper-cased for you, so an i18n locale like ",[153,1067,1068],{},"en-us"," is accepted where a\n",[153,1071,1072],{},"LanguageCode"," is expected. Pass Shopify's enum codes, not a locale string: ",[153,1075,912],{}," is a ",[153,1078,1079],{},"CountryCode",[153,1081,1016],{},[153,1083,1084],{},"DE",") and\n",[153,1087,413],{},[153,1089,1072],{},[153,1091,432],{},[153,1093,1094],{},"PT_BR","). Each market is resolved once and cached, and a market Shopify does not\nrecognize falls back to whatever was resolved before it, so a bad code degrades the reported market instead of\nsilencing analytics.",[140,1097,1098,1100,1101,1103],{},[153,1099,409],{}," and ",[153,1102,413],{}," in your configuration remain the default for the first resolve; setting both still skips the\ninitial lookup entirely.",[891,1105,1107],{"id":1106},"cart-events","Cart events",[140,1109,1110],{},"Cart events are derived, so you never publish them yourself. Keep the cart in sync after every mutation and the module\nworks out what changed by diffing the previous cart against the new one:",[167,1112,1114],{"className":209,"code":1113,"language":211,"meta":173,"style":173},"const analytics = useShopifyAnalytics()\n\nconst { data } = await addToCartMutation()\n\nanalytics.setCart({\n  ...data.cart,\n  lines: flattenConnection(data.cart.lines),\n})\n",[153,1115,1116,1128,1132,1153,1157,1170,1185,1209],{"__ignoreMap":173},[177,1117,1118,1120,1122,1124,1126],{"class":179,"line":180},[177,1119,753],{"class":518},[177,1121,756],{"class":229},[177,1123,522],{"class":233},[177,1125,761],{"class":225},[177,1127,764],{"class":229},[177,1129,1130],{"class":179,"line":237},[177,1131,273],{"emptyLinePlaceholder":272},[177,1133,1134,1136,1138,1141,1143,1145,1148,1151],{"class":179,"line":249},[177,1135,753],{"class":518},[177,1137,960],{"class":233},[177,1139,1140],{"class":229}," data ",[177,1142,353],{"class":233},[177,1144,949],{"class":233},[177,1146,1147],{"class":218}," await",[177,1149,1150],{"class":225}," addToCartMutation",[177,1152,764],{"class":229},[177,1154,1155],{"class":179,"line":269},[177,1156,273],{"emptyLinePlaceholder":272},[177,1158,1159,1161,1163,1166,1168],{"class":179,"line":276},[177,1160,366],{"class":229},[177,1162,396],{"class":233},[177,1164,1165],{"class":225},"setCart",[177,1167,230],{"class":229},[177,1169,234],{"class":233},[177,1171,1172,1175,1178,1180,1183],{"class":179,"line":286},[177,1173,1174],{"class":233},"  ...",[177,1176,1177],{"class":229},"data",[177,1179,396],{"class":233},[177,1181,1182],{"class":229},"cart",[177,1184,266],{"class":233},[177,1186,1187,1190,1192,1195,1198,1200,1202,1204,1207],{"class":179,"line":296},[177,1188,1189],{"class":240},"  lines",[177,1191,206],{"class":233},[177,1193,1194],{"class":225}," flattenConnection",[177,1196,1197],{"class":229},"(data",[177,1199,396],{"class":233},[177,1201,1182],{"class":229},[177,1203,396],{"class":233},[177,1205,1206],{"class":229},"lines)",[177,1208,266],{"class":233},[177,1210,1211,1213],{"class":179,"line":313},[177,1212,353],{"class":233},[177,1214,356],{"class":229},[140,1216,1217,1218,1221,1222,1225,1226,1229,1230,1232],{},"That publishes ",[153,1219,1220],{},"cart_updated",", plus a ",[153,1223,1224],{},"product_added_to_cart"," or ",[153,1227,1228],{},"product_removed_from_cart"," for every line whose\nquantity changed. Only ",[153,1231,1224],{}," reaches Shopify; the other two are for your own subscribers.",[140,1234,1235,1236,1100,1239,1242,1243,1100,1246,1249,1250,1252],{},"The cart needs ",[153,1237,1238],{},"id",[153,1240,1241],{},"updatedAt",", and each line needs ",[153,1244,1245],{},"merchandise.product.id",[153,1247,1248],{},"merchandise.product.vendor",", or\nthe event cannot be attributed. Updates carrying an ",[153,1251,1241],{}," that was already reported are ignored, so a reload never\nre-reports a cart.",[891,1254,1256],{"id":1255},"forwarding-to-other-tools","Forwarding to other tools",[140,1258,1259,1260,1262],{},"Because everything runs through one bus, ",[153,1261,834],{}," is also how you fan events out to a third-party provider such as GA4 or Meta:",[167,1264,1267],{"className":209,"code":1265,"filename":1266,"language":211,"meta":173,"style":173},"export default defineNuxtPlugin(() => {\n  const analytics = useShopifyAnalytics()\n\n  analytics.subscribe('product_added_to_cart', ({currentLine }) => {\n    gtag('event', 'add_to_cart', { \u002F* map from currentLine *\u002F })\n  })\n})\n","~\u002Fapp\u002Fplugins\u002Fga.client.ts",[153,1268,1269,1285,1297,1301,1333,1367,1373],{"__ignoreMap":173},[177,1270,1271,1273,1275,1277,1279,1281,1283],{"class":179,"line":180},[177,1272,219],{"class":218},[177,1274,222],{"class":218},[177,1276,930],{"class":225},[177,1278,230],{"class":229},[177,1280,935],{"class":233},[177,1282,857],{"class":518},[177,1284,246],{"class":233},[177,1286,1287,1289,1291,1293,1295],{"class":179,"line":237},[177,1288,944],{"class":518},[177,1290,829],{"class":229},[177,1292,949],{"class":233},[177,1294,761],{"class":225},[177,1296,764],{"class":240},[177,1298,1299],{"class":179,"line":249},[177,1300,273],{"emptyLinePlaceholder":272},[177,1302,1303,1306,1308,1310,1312,1314,1316,1318,1320,1323,1326,1329,1331],{"class":179,"line":269},[177,1304,1305],{"class":229},"  analytics",[177,1307,396],{"class":233},[177,1309,834],{"class":225},[177,1311,230],{"class":240},[177,1313,263],{"class":233},[177,1315,1224],{"class":187},[177,1317,263],{"class":233},[177,1319,789],{"class":233},[177,1321,1322],{"class":233}," ({",[177,1324,1325],{"class":850},"currentLine",[177,1327,1328],{"class":233}," })",[177,1330,857],{"class":518},[177,1332,246],{"class":233},[177,1334,1335,1338,1340,1342,1345,1347,1349,1351,1354,1356,1358,1360,1363,1365],{"class":179,"line":276},[177,1336,1337],{"class":225},"    gtag",[177,1339,230],{"class":240},[177,1341,263],{"class":233},[177,1343,1344],{"class":187},"event",[177,1346,263],{"class":233},[177,1348,789],{"class":233},[177,1350,257],{"class":233},[177,1352,1353],{"class":187},"add_to_cart",[177,1355,263],{"class":233},[177,1357,789],{"class":233},[177,1359,960],{"class":233},[177,1361,1362],{"class":500}," \u002F* map from currentLine *\u002F",[177,1364,966],{"class":233},[177,1366,356],{"class":240},[177,1368,1369,1371],{"class":179,"line":286},[177,1370,1039],{"class":233},[177,1372,356],{"class":240},[177,1374,1375,1377],{"class":179,"line":296},[177,1376,353],{"class":233},[177,1378,356],{"class":229},[193,1380,458],{"id":452},[140,1382,1383,1384,1389],{},"Every event is gated on Shopify's ",[147,1385,1388],{"href":1386,"rel":1387},"https:\u002F\u002Fshopify.dev\u002Fdocs\u002Fapi\u002Fcustomer-privacy",[151],"Customer Privacy API",". In regions that\nrequire opt-in, such as the EU, nothing is sent and no tracking cookies are set until the visitor consents. Elsewhere,\nShopify's API may permit tracking by default. Either way, consent is dictated by Shopify, not the module.",[140,1391,1392],{},"Point consent at your checkout domain so it is shared between your storefront and Shopify's checkout:",[167,1394,1396],{"className":209,"code":1395,"filename":205,"language":211,"meta":173,"style":173},"export default defineNuxtConfig({\n  shopify: {\n    analytics: {\n      storefrontId: '1234567',\n      consent: {\n        checkoutDomain: 'checkout.my-shop.com',\n      },\n    },\n  },\n})\n",[153,1397,1398,1410,1418,1426,1442,1451,1467,1471,1475,1479],{"__ignoreMap":173},[177,1399,1400,1402,1404,1406,1408],{"class":179,"line":180},[177,1401,219],{"class":218},[177,1403,222],{"class":218},[177,1405,226],{"class":225},[177,1407,230],{"class":229},[177,1409,234],{"class":233},[177,1411,1412,1414,1416],{"class":179,"line":237},[177,1413,241],{"class":240},[177,1415,206],{"class":233},[177,1417,246],{"class":233},[177,1419,1420,1422,1424],{"class":179,"line":249},[177,1421,333],{"class":240},[177,1423,206],{"class":233},[177,1425,246],{"class":233},[177,1427,1428,1431,1433,1435,1438,1440],{"class":179,"line":269},[177,1429,1430],{"class":240},"      storefrontId",[177,1432,206],{"class":233},[177,1434,257],{"class":233},[177,1436,1437],{"class":187},"1234567",[177,1439,263],{"class":233},[177,1441,266],{"class":233},[177,1443,1444,1447,1449],{"class":179,"line":276},[177,1445,1446],{"class":240},"      consent",[177,1448,206],{"class":233},[177,1450,246],{"class":233},[177,1452,1453,1456,1458,1460,1463,1465],{"class":179,"line":286},[177,1454,1455],{"class":240},"        checkoutDomain",[177,1457,206],{"class":233},[177,1459,257],{"class":233},[177,1461,1462],{"class":187},"checkout.my-shop.com",[177,1464,263],{"class":233},[177,1466,266],{"class":233},[177,1468,1469],{"class":179,"line":296},[177,1470,316],{"class":233},[177,1472,1473],{"class":179,"line":313},[177,1474,322],{"class":233},[177,1476,1477],{"class":179,"line":319},[177,1478,347],{"class":233},[177,1480,1481,1483],{"class":179,"line":325},[177,1482,353],{"class":233},[177,1484,356],{"class":229},[377,1486,1487,1491,1498,1505,1508],{},[380,1488,1490],{"name":1489,"type":383},"checkoutDomain","Your checkout domain. Defaults to the store domain.",[380,1492,1494,1495,396],{"name":1493,"type":383},"storefrontAccessToken","Public storefront token used by the consent API. Defaults to the storefront client's ",[153,1496,1497],{},"publicAccessToken",[380,1499,1501,1502,1504],{"name":1500,"type":438},"withPrivacyBanner","Load Shopify's own cookie banner. Defaults to ",[153,1503,374],{},". Leave it off to build your own.",[380,1506,1507],{"name":912,"type":383},"Two-letter country code passed to Shopify's privacy banner.",[380,1509,1510],{"name":413,"type":383},"Locale passed to Shopify's privacy banner.",[891,1512,1514],{"id":1513},"recording-consent","Recording consent",[140,1516,1517],{},"Record the visitor's choice through the composable, or from your own banner:",[167,1519,1521],{"className":209,"code":1520,"language":211,"meta":173,"style":173},"const analytics = useShopifyAnalytics()\n\nanalytics.setTrackingConsent({\n  analytics: true,\n  marketing: true,\n  preferences: true,\n  sale_of_data: true,\n})\n",[153,1522,1523,1535,1539,1552,1562,1573,1584,1595],{"__ignoreMap":173},[177,1524,1525,1527,1529,1531,1533],{"class":179,"line":180},[177,1526,753],{"class":518},[177,1528,756],{"class":229},[177,1530,522],{"class":233},[177,1532,761],{"class":225},[177,1534,764],{"class":229},[177,1536,1537],{"class":179,"line":237},[177,1538,273],{"emptyLinePlaceholder":272},[177,1540,1541,1543,1545,1548,1550],{"class":179,"line":249},[177,1542,366],{"class":229},[177,1544,396],{"class":233},[177,1546,1547],{"class":225},"setTrackingConsent",[177,1549,230],{"class":229},[177,1551,234],{"class":233},[177,1553,1554,1556,1558,1560],{"class":179,"line":269},[177,1555,1305],{"class":240},[177,1557,206],{"class":233},[177,1559,339],{"class":338},[177,1561,266],{"class":233},[177,1563,1564,1567,1569,1571],{"class":179,"line":276},[177,1565,1566],{"class":240},"  marketing",[177,1568,206],{"class":233},[177,1570,339],{"class":338},[177,1572,266],{"class":233},[177,1574,1575,1578,1580,1582],{"class":179,"line":286},[177,1576,1577],{"class":240},"  preferences",[177,1579,206],{"class":233},[177,1581,339],{"class":338},[177,1583,266],{"class":233},[177,1585,1586,1589,1591,1593],{"class":179,"line":296},[177,1587,1588],{"class":240},"  sale_of_data",[177,1590,206],{"class":233},[177,1592,339],{"class":338},[177,1594,266],{"class":233},[177,1596,1597,1599],{"class":179,"line":313},[177,1598,353],{"class":233},[177,1600,356],{"class":229},[140,1602,1603,1606,1607,371,1610,371,1613,1616,1617,1619],{},[153,1604,1605],{},"ShopifyPrivacyBanner"," is a renderless component that holds ",[153,1608,1609],{},"accept",[153,1611,1612],{},"decline",[153,1614,1615],{},"setConsent",", and ",[153,1618,883],{},"\nthrough its slot, you can style the banner however you like:",[167,1621,1623],{"className":479,"code":1622,"language":482,"meta":173,"style":173},"\u003Ctemplate>\n  \u003CShopifyPrivacyBanner v-slot=\"{ accept, decline }\">\n    \u003Cdiv class=\"banner\">\n      \u003Cp>We use cookies to measure our store.\u003C\u002Fp>\n\n      \u003Cbutton @click=\"accept\">\n        Accept\n      \u003C\u002Fbutton>\n\n      \u003Cbutton @click=\"decline\">\n        Decline\n      \u003C\u002Fbutton>\n    \u003C\u002Fdiv>\n  \u003C\u002FShopifyPrivacyBanner>\n\u003C\u002Ftemplate>\n",[153,1624,1625,1633,1653,1675,1694,1698,1718,1723,1732,1736,1754,1759,1767,1776,1785],{"__ignoreMap":173},[177,1626,1627,1629,1631],{"class":179,"line":180},[177,1628,489],{"class":233},[177,1630,492],{"class":240},[177,1632,495],{"class":233},[177,1634,1635,1637,1639,1642,1644,1646,1649,1651],{"class":179,"line":237},[177,1636,510],{"class":233},[177,1638,1605],{"class":240},[177,1640,1641],{"class":518}," v-slot",[177,1643,522],{"class":233},[177,1645,525],{"class":233},[177,1647,1648],{"class":187},"{ accept, decline }",[177,1650,525],{"class":233},[177,1652,495],{"class":233},[177,1654,1655,1658,1661,1664,1666,1668,1671,1673],{"class":179,"line":249},[177,1656,1657],{"class":233},"    \u003C",[177,1659,1660],{"class":240},"div",[177,1662,1663],{"class":518}," class",[177,1665,522],{"class":233},[177,1667,525],{"class":233},[177,1669,1670],{"class":187},"banner",[177,1672,525],{"class":233},[177,1674,495],{"class":233},[177,1676,1677,1680,1682,1685,1688,1690,1692],{"class":179,"line":269},[177,1678,1679],{"class":233},"      \u003C",[177,1681,140],{"class":240},[177,1683,1684],{"class":233},">",[177,1686,1687],{"class":229},"We use cookies to measure our store.",[177,1689,582],{"class":233},[177,1691,140],{"class":240},[177,1693,495],{"class":233},[177,1695,1696],{"class":179,"line":276},[177,1697,273],{"emptyLinePlaceholder":272},[177,1699,1700,1702,1705,1708,1710,1712,1714,1716],{"class":179,"line":286},[177,1701,1679],{"class":233},[177,1703,1704],{"class":240},"button",[177,1706,1707],{"class":518}," @click",[177,1709,522],{"class":233},[177,1711,525],{"class":233},[177,1713,1609],{"class":187},[177,1715,525],{"class":233},[177,1717,495],{"class":233},[177,1719,1720],{"class":179,"line":296},[177,1721,1722],{"class":229},"        Accept\n",[177,1724,1725,1728,1730],{"class":179,"line":313},[177,1726,1727],{"class":233},"      \u003C\u002F",[177,1729,1704],{"class":240},[177,1731,495],{"class":233},[177,1733,1734],{"class":179,"line":319},[177,1735,273],{"emptyLinePlaceholder":272},[177,1737,1738,1740,1742,1744,1746,1748,1750,1752],{"class":179,"line":325},[177,1739,1679],{"class":233},[177,1741,1704],{"class":240},[177,1743,1707],{"class":518},[177,1745,522],{"class":233},[177,1747,525],{"class":233},[177,1749,1612],{"class":187},[177,1751,525],{"class":233},[177,1753,495],{"class":233},[177,1755,1756],{"class":179,"line":330},[177,1757,1758],{"class":229},"        Decline\n",[177,1760,1761,1763,1765],{"class":179,"line":344},[177,1762,1727],{"class":233},[177,1764,1704],{"class":240},[177,1766,495],{"class":233},[177,1768,1769,1772,1774],{"class":179,"line":350},[177,1770,1771],{"class":233},"    \u003C\u002F",[177,1773,1660],{"class":240},[177,1775,495],{"class":233},[177,1777,1778,1781,1783],{"class":179,"line":573},[177,1779,1780],{"class":233},"  \u003C\u002F",[177,1782,1605],{"class":240},[177,1784,495],{"class":233},[177,1786,1787,1789,1791],{"class":179,"line":579},[177,1788,582],{"class":233},[177,1790,492],{"class":240},[177,1792,495],{"class":233},[140,1794,1795,1796,1799],{},"If you set ",[153,1797,1798],{},"withPrivacyBanner: true",", Shopify renders its own banner and you can skip this component entirely.",[1801,1802,1803],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}",{"title":173,"searchDepth":237,"depth":237,"links":1805},[1806,1807,1808,1809,1814],{"id":195,"depth":237,"text":196},{"id":359,"depth":237,"text":360},{"id":462,"depth":237,"text":463},{"id":735,"depth":237,"text":736,"children":1810},[1811,1812,1813],{"id":893,"depth":249,"text":425},{"id":1106,"depth":249,"text":1107},{"id":1255,"depth":249,"text":1256},{"id":452,"depth":237,"text":458,"children":1815},[1816],{"id":1513,"depth":249,"text":1514},"Send Shopify headless analytics from your Nuxt storefront","md",null,{},{"icon":81},{"title":78,"description":1817},"99gu2bQLzeytnG4ULNTZUbl6-Vd1LWJ6apPceD0ZA7w",[1825,1827],{"title":73,"path":74,"stem":75,"description":1826,"icon":76,"children":-1},"Automatically typed queries and mutations for your Nuxt Shopify project",{"title":89,"path":90,"stem":91,"description":1828,"icon":92,"children":-1},"How to create a navigation menu for your Shopify store in Nuxt",1784461702799]