@shopify/react-tracking-pixel

Allows React apps to easily embed tracking pixel iframes

Usage no npm install needed!

<script type="module">
  import shopifyReactTrackingPixel from 'https://cdn.skypack.dev/@shopify/react-tracking-pixel';
</script>

README

@shopify/react-tracking-pixel

Build Status Build Status License: MIT npm version npm bundle size (minified + gzip)

Allows React apps to easily embed tracking pixel iframes.

Installation

$ yarn add @shopify/react-tracking-pixel

Usage

This library exports a <TrackingPixel /> component, which allows React apps to easily embed tracking pixel iframes.

Basic Example

import TrackingPixel from 'react-tracking-pixel';

// ...

const myurl = 'myurl';

<TrackingPixel url={myurl} />;

With Proconnected Hosts

import TrackingPixel from 'react-tracking-pixel';

// ...

const myurl = 'myurl';
const myhosts = ['example.com', 'moreexamples.com'];

<TrackingPixel url={myurl} preconnectHosts={myhosts} />;

Interface

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[];
}