Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
react-i13n
Advanced tools
react-i13n
provides a performant and scalable approach to instrumentation.
In most cases, you will have to manually add the code to what you want to track, e.g., you have to hook onClick
to the links you want to track. react-i13n
provide a convenient approach for you to do the instrumentation, all you have to do is to define the data model you want to beacon out.
Moreover, we provide a mechanism to build the instrumentation tree
, typically you might have to manage the instrumentation model data
you want and send out beacons separately, by using react-i13n
, you have a better way to manage beacon data with an inheritance architecture, refer to integrate with components to see how do we get the benifit of react-i13n
.
It's originated from Rafael Martins. More implement detail please refer to Main Ideas section.
react-i13n
is pluggable to integrate any data analytics library into the same tree architecture. All that is needed is to implement the plugin and the handler functions which integrate with the libraries transport functions.i13nModel
could be a plain object or a dynamic function
with a proper i13nModel
object return, which means you can dynamically change i13nModel
data without causing re-render due to the props
changes.pageview
on both server and client side, which means you could select a prefer way to handle the event.I13nNode
, it could be used to know if you want to send out the data only when node is in viewport.react-i13n
utilizes the life cycle events provided by React
to build an i13n tree that mirrors the React component hierarchy. This approach optimizes for performance by reducing the need to scrape the DOM for data before beaconing.
react-i13n
build the I13n Tree
with context
and life cycle event componentWillMount
, we can define the i13nModel
data we need. Which means we don't need additional DOM manipulation when we want to get i13nModel
values for sending out beacons for the link.i13nModel
for certain node, it traverses back to the root and merge all the i13nModel
information in the path. Since the tree is already built and we don't need extra DOM access, it should be pretty cheap and efficient.npm install react-i13n
var React = require('react/addons');
var ReactI13n = require('react-i13n').ReactI13n;
var setupI13n = require('react-i13n').setupI13n;
var somePlugin = require('some-i13n-plugin'); // a plugin for a certain instrumentation mechanism
// create a i13n anchor for link tracking
var createI13nNode = require('react-i13n').createI13nNode;
var I13nAnchor = createI13nNode('a', {
isLeafNode: true,
bindClickEvent: true,
follow: true
});
var DemoApp = React.createClass({
componentWillMount: function () {
ReactI13n.getInstance().execute('pageview', {}); // fire a custom event
},
render: function () {
...
<I13nAnchor href="http://foo.bar" i13nModel={{action: 'click', label: 'foo'}}>...</I13nAnchor>
// this link will be tracked, and the click event handlers provided the plugin will get the model data as
// {site: 'foo', action: 'click', label: 'foo'}
}
});
var I13nDempApp = setupI13n(DemoApp, {
rootModelData: {site: 'foo'},
isViewportEnabled: true
}, [somePlugin]);
// then you could use I13nDemoApp to render you app
grunt unit
to run simply unit testgrunt cover
to generate the coverage reportgrunt functional-debug
http://127.0.0.1:9999/tests/functional/page.html
saucelabs
:
grunt functional
FAQs
React I13n provides a performant and scalable solution to application instrumentation.
The npm package react-i13n receives a total of 1,911 weekly downloads. As such, react-i13n popularity was classified as popular.
We found that react-i13n demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.