@ta-interaktiv/react-tracking
v3.1.1
Published
Component to track visits to a website, accessing the Newsnet API for all tracking information.
Downloads
105
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}
/>
)
}