Track Page Views
import React from "react";
import {
IntelligemsNextClientsideProvider,
useIgTrack,
} from "@intelligems/headless/next-clientside";
const IntelligemsTracker = () => {
const { checkout } = React.useContext(StoreContext);
useIgTrack({
cartOrCheckoutToken: checkout?.id,
currency: checkout?.totalTaxV2?.currencyCode,
country: "US",
});
return null;
};
export default function MyApp({ Component, pageProps }: AppProps) {
return (
<IntelligemsNextClientsideProvider
organizationId={process.env.NEXT_PUBLIC_INTELLIGEMS_ORG_ID}
storefrontApiToken={
process.env.NEXT_PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN
}
antiFlicker={true}
>
<StoreProvider>
<IntelligemsTracker />
<Component {...pageProps} />
</StoreProvider>
</IntelligemsNextClientsideProvider>
);
}Last updated