import {register} from '@shopify/web-pixels-extension'; register(({analytics}) => { analytics.subscribe('alert_displayed', (event) => { // Example for accessing event data const {target, type, message} = event.data.alert; const payload = { event_name: event.name, event_data: { target, type, message, }, }; // Example for sending event data to third party servers fetch('https://example.com/pixel', { method: 'POST', body: JSON.stringify(payload), keepalive: true, }); }); }); import {register} from '@shopify/web-pixels-extension'; register(({analytics}) => { analytics.subscribe('cart_viewed', (event) => { // Example for accessing event data const totalCartCost = event.data.cart.cost.totalAmount.amount; const firstCartLineItemName = event.data.cart.lines[0]?.merchandise.product.title; const payload = { event_name: event.name, event_data: { cartCost: totalCartCost, firstCartItemName: firstCartLineItemName, }, }; // Example for sending event data to third party servers fetch('https://example.com/pixel', { method: 'POST', body: JSON.stringify(payload), keepalive: true, }); }); }); });})(self.webPixelsManager.createShopifyExtend('100565078', 'custom'));