DocsDevelopers

Analytics events

The app publishes customer events through Shopify’s Customer Events (Web Pixels). Subscribe to them in a custom pixel and forward them to Google Analytics or any other tool.

Coding knowledge needed

Setting up a custom pixel requires basic JavaScript knowledge. See Shopify’s documentation on custom pixels. We don’t provide support for third-party analytics tools: ask your developer or agency.

Set up a custom pixel

  1. In your Shopify admin, go to Settings › Customer events.
  2. Click Add custom pixel, give it a name, and paste your code.
  3. Save and Connect the pixel.

Inside the pixel, subscribe to the events below with analytics.subscribe. Event data is available in event.customData. See a complete example in Shopify’s documentation.

Events

EventTriggered whenPlan
comparison_product_viewedA customer clicks View details in a comparison tableAll
dynamic_comparison_product_addedA product is added to the dynamic comparisonPro
dynamic_comparison_product_removedA product is removed from the dynamic comparisonPro
dynamic_comparison_modal_openedThe dynamic comparison dialog is openedPro

Need another event? Tell us about your use case.

comparison_product_viewed

Published when a customer clicks the View details button of a product, in a comparison table or in the dynamic comparison dialog.

PropertyDescription
product.idID of the product.
product.handleHandle of the product.
JavaScript
analytics.subscribe('comparison_product_viewed', (event) => {
  console.log(event.customData.product.id, event.customData.product.handle);
});

dynamic_comparison_product_added

PropertyDescription
product.handleHandle of the added product.
JavaScript
analytics.subscribe('dynamic_comparison_product_added', (event) => {
  console.log(event.customData.product.handle);
});

dynamic_comparison_product_removed

PropertyDescription
product.handleHandle of the removed product.
JavaScript
analytics.subscribe('dynamic_comparison_product_removed', (event) => {
  console.log(event.customData.product.handle);
});

dynamic_comparison_modal_opened

PropertyDescription
productsArray of { handle } for the products being compared.
JavaScript
analytics.subscribe('dynamic_comparison_modal_opened', (event) => {
  event.customData.products.forEach((product) => {
    console.log(product.handle);
  });
});

Example: send events to Google Analytics 4

JavaScript
// Custom pixel — replace G-XXXXXXX with your measurement ID
const script = document.createElement('script');
script.src = 'https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX';
script.async = true;
document.head.appendChild(script);

window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'G-XXXXXXX');

analytics.subscribe('dynamic_comparison_modal_opened', (event) => {
  gtag('event', 'compare_products', {
    items: event.customData.products.map((product) => ({ item_id: product.handle })),
  });
});

Privacy

Does this affect customer privacy? Shopify pixels respect customer privacy choices and don’t track visitors who opted out. Learn more.

Is data stored on your servers? No. Events are only sent through Shopify’s pixel system. We don’t collect or store them.

Still stuck?

Our support team answers every email, usually within one business day.

Contact support