link-painter
v1.1.3
Published
Add Query Parameters to Links in HTML
Downloads
8
Maintainers
Readme
link-painter
Add Query Parameters to Links in HTML
install
npm install link-painter
example
const queryParams = {
utm_source: 'newsletter',
utm_medium: 'link',
utm_campaign: 'link-painter'
};
const html = fs.createReadStream('./sample.html', 'utf-8');
const result = await getStream(html.pipe(new LinkPainter('my.example.com', queryParams)));
yields:
<!DOCTYPE html>
<html>
<head></head>
<body>
<div><a href="https://my.example.com/?utm_source=newsletter&utm_medium=link&utm_campaign=link-painter">click me</a></div>
<div><a href="https://google.com">or me</a></div>
</body>
</html>