@ta-interaktiv/react-tracking

Component to track visits to a website, accessing the Newsnet API for all tracking information.

Stats

stars 🌟issues ⚠️updated 🛠created 🐣size 🏋️‍♀️
Minified + gzip package size for @ta-interaktiv/react-tracking in KB

Readme

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

yarn add @ta-interaktiv/react-tracking

Usage

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

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

Add in data directly, circumventing network requests:

// 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.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.