Skip to main content
Migrate to Polaris

Version 2025-07 is the last API version to support React-based UI components. Later versions use web components, native UI elements with built-in accessibility, better performance, and consistent styling with Shopify's design system. Check out the migration guide to upgrade your extension.

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?