Eleventy plugin wrapper around @inframanufaktur/clean-urls. Because cool kids don’t let their friends click tracking.
This package adds a transform to your eleventyConfig
which removes those pesky tracking params (such as utm_campaign
or fbclid
) from links in your HTML.
First, install:
npm install @inframanufaktur/eleventy-plugin-clean-urls
Second, add the plugin to your config:
const pluginCleanUrls = require("@inframanufaktur/eleventy-plugin-clean-urls");
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(pluginCleanUrls);
};
Want to know what gets removed? See the full list of removed params, and the associated companies.
This plugin is a wrapper around our clean-urls
package. There’s currently one configuration option, which is a allow-list to allow tracking params from a specific company.
const pluginCleanUrls = require("@inframanufaktur/eleventy-plugin-clean-urls");
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(pluginCleanUrls, { allowlist: ["Piwik"] });
};
Using this example all Piwik tracking params (pk_campaign
and so forth) will be kept in your HTML.
We are parsing your HTML using linkedom
, getting all links to external sources and search for tracking params on them. If we find some, we delete them.