Skip to main content
Upgrade to Polaris

Version 2025-07 is the last API version to support React-based UI components. Later versions use Polaris web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the upgrade guide to upgrade your extension and avoid being blocked from updating your extension after October 1st 2026.

Analytics API

The API for interacting with web pixels.

The base API object provided to purchase extension targets.

Anchor to analytics
analytics
required

The methods for interacting with Web Pixels, such as emitting an event.

Examples
import {useState, useEffect} from 'react';
import {
Banner,
reactExtension,
useApi,
} from '@shopify/ui-extensions-react/checkout';

export const purchaseCheckoutBlockRender =
reactExtension(
'purchase.checkout.block.render',
() => <Extension />,
);

function Extension() {
const {analytics} = useApi();

analytics
.publish('checkout-extension-loaded', {
extensionName: 'My Extension',
})
.then((result) => {
if (result) {
console.log(
'succesfully published event, web pixels can now recieve this event',
);
} else {
console.log('failed to publish event');
}
})
.catch((error) => {
console.log('failed to publish event');
console.log('error', error);
});

return <Banner>See console for result</Banner>;
}


Was this page helpful?