russellsteadman / affiliate Goto Github PK
View Code? Open in Web Editor NEWAdd affiliation tags to links automatically in the browser
Home Page: https://affiliate.js.org/
License: MIT License
Add affiliation tags to links automatically in the browser
Home Page: https://affiliate.js.org/
License: MIT License
Hi, thanks for your script.
Is-it possible to make a plugin or function to convert shorten amazon links (ex: https://amzn.to/3EYDIZO) to real amazon.fr link with my tag? Because i have a forum and people post amzn.to links to bypass affiliate-js
Thanks!
Can I add affiliate tags to anything other than Amazon? Can I add tags to eBay, Walmart, Alibaba?
Also, do you support tracking IDs for Amazon?
Hi,
I'm very interested in the library but I think it would be better to separate the affiliate utilities from the DOM related functionality. This way could be used for more projects, for example, creating the affiliates in a backend with Node where the DOM functionality is not needed. Also, both packages could be maintained independently.
I've been doing tests and got it to work without the DOM functionality using the 'convert' function but still this code is loaded in the application.
const aff = window.Affiliate.create({
tags: [
{
hosts: ['amazon.es', 'www.amazon.es'],
query: {
tag: 'my-super-affiliate', // This means ?ref=my-tag
},
},
],
});
console.log(aff.convert('https://www.amazon.es/LEGO-10212-Star-Lanzadera-imperial/dp/B0041I0N9A/?_encoding=UTF8&pd_rd_w=Mqdi6&content-id=amzn1.sym.dfbf490a-d858-4445-bf49-2916dec94084&pf_rd_p=dfbf490a-d858-4445-bf49-2916dec94084&pf_rd_r=XAQC9NM704AV77FZ278M&pd_rd_wg=rmQ9K&pd_rd_r=e03e1afd-e5f6-426d-90ef-602a0a48d39b&ref_=pd_gw_ci_mcx_mr_hp_atf_m&tag=test')); // convert a provided URL or string
console.log(aff.convert('https://www.amazon.es/dp/B0041I0N9A')); // convert a provided URL or string
// Output
"https://www.amazon.es/LEGO-10212-Star-Lanzadera-imperial/dp/B0041I0N9A/?_encoding=UTF8&pd_rd_w=Mqdi6&content-id=amzn1.sym.dfbf490a-d858-4445-bf49-2916dec94084&pf_rd_p=dfbf490a-d858-4445-bf49-2916dec94084&pf_rd_r=XAQC9NM704AV77FZ278M&pd_rd_wg=rmQ9K&pd_rd_r=e03e1afd-e5f6-426d-90ef-602a0a48d39b&ref_=pd_gw_ci_mcx_mr_hp_atf_m&tag=my-super-affiliate"
"https://www.amazon.es/dp/B0041I0N9A?tag=my-super-affiliate"
What do you think of my proposal?
Thank you very much for the work, and I am willing to collaborate in the project if you need my help or I see something to improve 🚀
Hi,
Could you update the npm package to V5? And add the changelog, please,
Thank!! 🔥
Coping and pasting the instructions of https://affiliate.js.org/plugins/amazon, when it executes the attach method it begins to throw exceptions about Docile that block the render of the page.
The message that console shows is : [Docile] DOM not loaded. Learn More: https://goo.gl/EsYspK
First off, thank you for building Affiliate. It's got a pretty ergonomic API and does exactly what it says on the box.
Now, I use Affiliate on a few websites for clients of my side hustle. The sites use a pretty common stack: Next.js (React.js) w/ TypeScript & a headless CMS of some sort. Because I use TS, I try to keep all my dependencies typed if I can. One of the few dependencies that I currently make an exception for is Affiliate because it's basically the only game in town.
So, the reason for this issue is to let you know I'd really appreciate Typescript support. If it's a non-starter I totally get it, but I figured it'd be worthwhile to show support for adding it just in-case you were on the fence about it.
Hi there,
Do you have functions like adding target and rel attributions for affiliate urls?
Thank you.
Let's say I have a simple form with an input field where I would insert an Amazon product URL https://www.amazon.com/dp/B01MRZFBBH
On form submit, I would like this Amazon product URL to turn into https://www.amazon.com/dp/B01MRZFBBH?tag=us-tag
and display below the form to the end user to copy.
How can I accomplish that with this library?
Is it possible to create an AWS affiliate link with a specified product name (like cheese) programmatically/dynamically?
What are my options? Can I do this using this library?
Hi @russellsteadman,
I'm implementing now Affiliate
and AffiliatePluginAmazon
with the intention to use the new aff.convert()
method, added in v5 after our last thread here: #31 (comment)
However, as I'm putting it all together in my React app, I noticed it is throwing me out an error in the console when the aff.convert()
method is called.
I'm adding below parts of the relevant Affiliate
and AffiliatePluginAmazon
code for a greater context of what I have running over here that produce this error.
// ...
import Affiliate from "affiliate";
import AffiliatePluginAmazon from "affiliate-plugin-amazon";
// ...
const amazonAff = AffiliatePluginAmazon(Affiliate, {
tags: {
us: "amzapplink-20", // for USA, required
gb: "", // for UK
de: "", // for Germany
fr: "", // for France
jp: "", // for Japan
ca: "", // for Canada
cn: "", // for China
it: "", // for Italy
es: "", // for Spain
in: "", // for India
br: "", // for Brazil
mx: "", // for Mexico
},
debug: false, // verbose logging into the console, default off
locale: null, // manually set the country code of the browser, default automatic
modifyDomain: true, // modify domains like amazon.com to amazon.co.uk based on locale, default on
});
// ...
// Testing convert function.
console.log(amazonAff.convert("https://www.amazon.com"));
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.