Allows React apps to easily embed tracking pixel iframes.
$ yarn add @shopify/react-tracking-pixel
This library exports a <TrackingPixel />
component, which allows React apps to easily embed tracking pixel iframes.
import TrackingPixel from 'react-tracking-pixel';
// ...
const myurl = 'myurl';
<TrackingPixel url={myurl} />;
import TrackingPixel from 'react-tracking-pixel';
// ...
const myurl = 'myurl';
const myhosts = ['example.com', 'moreexamples.com'];
<TrackingPixel url={myurl} preconnectHosts={myhosts} />;
export interface Props {
url: string;
/**
* Additional hosts to preconnect to. These should be hosts that
* are connected to by the page that will be loaded in an iframe.
*/
preconnectHosts?: string[];
}