Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
@aller/blink
Advanced tools
Library for user behaviour tracking.
The main goal is to make tracking of user behavior in news sites easy.
This can be tracking of elements like article previews and ads.
Tracking of general user activity.
This is an idea of how we would like this library to be used.
pageload({ url, plussData });
screenEnter({ url, id, domElement }); // registers that a domElement has entered the screen (by a certain percent)
screenExit({ url, id, domElement }); // registers taht a domElement has left the screen
articleActivityStart({ url }); // sets the user as active for the next 10 seconds, if not else happens
articleActivityPause({ url }); // sets the user as inactive
articleActivityStop({ url }); // sets the user as inactive, and sends active time data
click({ url, id, domElement });
screenEnter({ url, id, domElement });
screenExit({ url, id, domElement });
dfpImpressionViewable();
dfpSlotRenderEnded();
dfpSlotOnload();
adLoad({ url, id, domElement });
requestStartTime({ url, id, domElement });
import blink from '@aller/blink';
blink.configure({
sendUrl: 'https://aas.medialaben.no/a',
sendInterval: 20000,
batchLimit: 3,
batchedSendInterval: 5000,
});
// Track active time
blink.trackActiveTime({
url: document.head.querySelector('meta[property="og:url"]'), // default: window.location.href
});
// Track page load
blink.trackPageLoad({
url: window.location.href,
});
// Track article clicks
blink.trackArticlePreviewClick({
selector: 'article.preview,.article-list>li',
// The url is parsed from the dom
});
// Track article impressions
blink.trackArticlePreviewImpression({
selector: 'article.preview,.article-list>li',
// The url is parsed from the dom
});
blink.trackAdImpressions({
selector: '.adunit',
selector0: '.adunit',
});
// Inside a root config file
import { BlinkProvider } from '@aller/blink';
return (
<BlinkProvider
prodUrl="https://aas.medialaben.no/a"
devUrl="http://localhost:3000/a"
sendInterval={20000}
batchLimit={3}
batchedSendInterval={5000}
trackActivity={false}
trackPageload={true}
>
<App />
</BlinkProvider>
);
// Inside a React component
import { BlinkTracker } from '@aller/blink';
return (
<BlinkTracker>
{({ trackClick }) => (
<Article
onClick={() =>
trackClick({
id: article.id,
url: article.url,
recommended: article.isRecommended,
})
}
/>
)}
</BlinkTracker>
);
// Inside a React component
import { BlinkTracker } from '@aller/blink';
return (
<BlinkTracker>
{({trackPageload}) => ... }
</BlinkTracker>
);
// Inside a React component
import { BlinkActivityTracker } from '@aller/blink';
return (
<Blink.ActivityTracker>
{({register, setIdle, stop}) => ... }
</Blink.ActivityTracker>
);
No function calls are needed, because the impression is on the container element
import { BlinkTrackerImpression } from '@aller/blink';
return (
<BlinkTracker.Impression
recommended={article.isRecommended}
url={article.url}
threshold={0.5}
>
<Article id={article.id} url={article.url} />
</BlinkTracker.Impression>
);
FAQs
A library for tracking user behaviour.
The npm package @aller/blink receives a total of 366 weekly downloads. As such, @aller/blink popularity was classified as not popular.
We found that @aller/blink demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.