1.1.3 • Published 5 years ago

link-painter v1.1.3

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

link-painter Build Status

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&amp;utm_medium=link&amp;utm_campaign=link-painter">click me</a></div>
		<div><a href="https://google.com">or me</a></div>
	</body>
</html>