Skip to content

Latest commit

 

History

History
56 lines (37 loc) · 1.63 KB

README.md

File metadata and controls

56 lines (37 loc) · 1.63 KB

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