Answer
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
There is nothing wrong with promoting products on the Amazon website in return for commission, if most of its products are permissible.
Answering your question, the Fatwa Center at Islam Q & A, states:
It is permissible to market and promote products on the Amazon website in return for commission and a percentage of the price of the product, so long as the product is permissible, and so long as the marketer does not pay anything in order to be allowed to market it.
It is not permissible to promote haram items, such as haram movies, and it is not permissible to receive commission for that.
Allah says: “And cooperate in righteousness and piety, but do not cooperate in sin and aggression. And fear Allah; indeed, Allah is severe in penalty.” (Al-Ma’idah 5:2)
What you have mentioned cookies, and that if anyone enters the website through your link and buys something on the same day, you will have a percentage of what he bought, comes under the heading of promoting the website in general, not promoting a particular product.
There is nothing wrong with promoting the website in return for commission, if most of its products are permissible.
What appears to be the case is that it is permissible to promote the Amazon website in general, in return for commission that you receive if someone who came to the website through your link buys something on the same day.
If it becomes clear to you that someone who came through your link bought something haram, there is no blame on you; rather the sin is on the purchaser, and the commission is permissible for you, because it was in return for promoting the website, not promoting the haram product. But if you get rid of that commission in that case, then it is better.
Almighty Allah knows best.
Source: https://islamqa.info/en/72315