@ta-interaktiv/react-polymorphic-tracking v1.0.1
React Polymorphic Tracking
React component that grabs the current tracking data from the Newsnet API and sets up the appropriate trackers (WEMF, Webseismo, Google Tag Manager).
Installation
yarn add @ta-interaktiv/react-polymorphic-trackingAPI
PolymorphicTracking
Extends React.PureComponent
Component to track visits to a website, accessing the Newsnet API for all tracking information. Currently supports GTM, WEMF and Webseismo. Additional Providers need to be added separately.
Parameters
articleIdstring? The article ID of the link article in the CD. If not available it will assume that content is being loaded in an iframe. (So, yes, you can use this component without adding thearticleIdattribute.)
Examples
import Tracking from '@ta-interaktiv/react-polymorphic-tracking'
function YourComponent (props) {
return (
<div>
<Tracking articleId='3352335' />
</div>
)
}trackWithImage
Helper function. Tracks a visit by calling the URL of a tracking pixel.
Parameters
srcstring The URL of the tracking pixel to use as the image source.
Returns void
Contributing
Code resides in /src.
This repository follows the Standard JS style. To fix your code, run
yarn run fixType checking is provided by Flow.
yarn run flowStyling
Styles reside in /style and/or /scss.
Testing
Test cases are provided using
Storybook. Add test cases in /stories/index.js,
and run them with
yarn run storybookThey will appear on http://localhost:9001.
Automated tests are written for Jest and can be found in /test. Run the
test suite using
yarn run testTranspiling
Babel is used to provide ES5 compatible code. To compile run
yarn run distDocumentation
Documentation is generated from source, using both JSDoc comments as well as Flow type annotations. Update the documentation in this file using
yarn run docsChangelog
The changelog is generated from git commits. In order to update the changelog, you may use
yarn run changelogā however, ever better is
Versioning
For correct tagging, updating the changelog etc. you can use the appropriate NPM scripts.
These scripts will 1. Bump the package.json version number 2. Update the documentation 3. Update the changelog 4. Commit these changes 5. Tag the commit with the correct version number
For project changes that improve the code in some way, but don't change the API in any way, use
yarn run version:patchFor project changes that add to the API or add functionality but will not affect the functioning of older implementations, use
yarn run version:minorFor project changes that change the component in a fundamental way that would require code that implemented an older version of this component to be rewritten, use
yarn run version:majorPublishing
In order to publish everything, both to the repository as well as NPM, use
yarn run push8 years ago