Package Exports
- affiliate
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (affiliate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Affiliate
Affiliate is a platform agnostic link affiliator. Simplify affiliating links with automatic affiliation in the browser. Affiliate works with libraries that mutate the DOM after the page loads, including React.
Installation
$ npm i -S affiliate
$ yarn add affiliate
$ bower install -S affiliate
Or use the Unpkg CDN
<script src="https://unpkg.com/affiliate@latest/dist/affiliate.js"></script>
What It Can Do
Affiliate can modify the following link into any of the others.
<a href="https://example.com/shop/product/item-id">Original</a>
<a href="https://example.com/shop/product/item-id?ref=my-tag">New Query Tags</a>
<a href="https://example.com/shop/product/item-id/ref/my-tag">Modified URL Path</a>
<a href="https://my-tag.example.com/shop/product/item-id">Modified Host Name</a>
Affiliate has easy plugins, such as one for Amazon, which simplify adding affiliate links even more.
Basic Setup
Read the documentation for more advanced usage.
// var Affiliate = require('affiliate');
var aff = Affiliate({
tags: [
{
hosts: ['example.com', 'www.example.com'],
query: {
ref: 'my-tag' // ?ref=my-tag
}
},
{
hosts: ['example.org', 'shop.example.org'],
query: {
tag: 'my-tag2' // ?tag=my-tag2
}
}
]
});
aff.attach();
Documentation
Affiliate is simple and quick to set up, even for more complex usage. Read the docs at: affiliate.js.org.
Testing
Affiliate is tested using Jasmine. The test of the minified packages is available here and the webpack package here.
Big Thanks
Cross-browser Testing Platform and Open Source <3 Provided by Sauce Labs!
License
MIT (C) Russell Steadman. Learn more in the LICENSE file.
Support Me
Like this project? Buy me a cup of coffee. ☕ Here are more of my projects.