Skip to content

Latest commit

 

History

History
 
 

react-tracking-pixel

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

@shopify/react-tracking-pixel

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