Plugin to track impressions based on route(s)
npm i fastify-impressions
const fastify = require("fastify")({ logging: false });
const fastifyImpressions = require("fastify-impressions");
fastify
.register("fastifyImpressions", {
blacklist: [], // specify URL's that are not to be tracked
trackSuccessOnly: false // track only success responses
})
.catch(console.error);
fastify.listen(8080, (err, address) => {
console.debug("Server started at:", address);
});
To see the impressions of the respective routes, access the /fastify-impressions
, and this should return a JSON response
blacklist
<Array>
- A list of URL's that should not be tracked
trackSuccessOnly
<Boolean>
- Enable this flag to track success responses only (200 series)
Licensed under ISC