# React Tracking

React component that grabs the current tracking data from the Newsnet API and
sets up the appropriate trackers (WEMF, Google Tag Manager).

## Installation

```bash
yarn add @ta-interaktiv/react-tracking
```

## Usage

Use the Newsnet API to download the necessary data, using the article ID:

```js
import Tracking from '@ta-interaktiv/react-tracking'
function YourComponent(props) {
  return (
    <div>
      <Tracking articleId='3352335' />
    </div>
  )
}
```

Add in data directly, circumventing network requests:

```js
// Access Newsnet API somewhere and get data
let newsnetData = fetch('m.tenant.ch/api/articles/111111/external_services')

render () {
  return (
    <Tracking articleId={111111}
              gtmId={newsnetData.configs.gtm_id}
              statisticsConfig={newsnetData.statistics}
    />
  )
}
```

## Documentation

[Can be found here.](https://gitlab.com/ta-interaktiv/packages/tree/master/packages/react-tracking/docs)
