@manaten/react-ga-sender
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

react-ga-sender

Simple google analytics sender component for React.

what?

A react component for google analytics pageview sending. This component takes two props trackingId and location. If location is changed, this component simply send ga event for trackingId.

usage

<GASender
  trackingId="YOUR-TRACKING-ID"
  location={{
    pathname: '/current/pathname',
    search: '?current=search'
  }}
/>

usage with react-router

import React from 'react';
import { withRouter } from 'react-router';
import { GASender } from '@manaten/ga-sender';

const GASenderWithRouter = withRouter(GASender);

// your app component
const App = (props) => (
  <main>
    <GASenderWithRouter trackingId="YOUR-TRACKING-ID" />
    ...
  </main>
)

Package Sidebar

Install

npm i @manaten/react-ga-sender

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

43 kB

Total Files

7

Last publish

Collaborators

  • manaten