@ta-interaktiv/react-tracking
TypeScript icon, indicating that this package has built-in type declarations

3.0.7 • Public • Published

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.

Versions

Current Tags

Version History

Package Sidebar

Install

npm i @ta-interaktiv/react-tracking

Weekly Downloads

288

Version

3.0.7

License

ISC

Unpacked Size

64.9 kB

Total Files

11

Last publish

Collaborators

  • s1co
  • dariush-mehdiaraghi
  • mrdz_tx
  • mathiaslutz
  • sebaa