Tuesday 7 Shawwal 1445 - 16 April 2024

Using cookies [computer files] for online marketing


What is the ruling on putting ads for products on my website according to what visitors to my blog are looking for? In other words, if a visitor is looking for movies, for example, then before he enters my blog, a cookie file will be made for him, then when he goes to my personal website, the cookies will be used to target an ad according to what he is looking for.


Praise be to Allah.


We have noted before that it is permissible to use advertising software if the ads are free of things that are forbidden according to Islamic teachings, and we mentioned the guidelines on the permissibility of that, in the answer to question no. 249126.

As for advertising movies, which you mentioned, that are not allowed, because movies contain many haraam things such as free mixing, music and wanton adornments, let alone promoting crime, corrupt beliefs and moral corruption.

The Muslim who publicizes and promotes such films is in grave danger; he must mend his ways and save himself and his religious commitment.

It was narrated from Abu Hurayrah that the Messenger of Allah (blessings and peace of Allah be upon him) said: “Whoever calls others to guidance will have a reward like that of those who follow it, without that detracting from their reward in the slightest. And whoever calls others to misguidance will have a burden of sin like that of those who follow it, without it detracting from their burden in the slightest.” Narrated by Muslim (2674).

The Muslim should not think lightly about the issue of haraam ads, because what he regards as trivial or insignificant could lead to his doom and corrupt his religious commitment. We ask Allah to keep us safe and sound.

It was narrated from Abu Hurayrah that the Prophet (blessings and peace of Allah be upon him) said: “A person may utter a word that pleases Allah, thinking nothing of it, by means of which Allah raises him several degrees in status. And a person may utter a word that angers Allah, thinking nothing of it, because of which he may fall into Hell.” Narrated by al-Bukhaari (6478).


It is known to Internet users that cookie files are something unique to each user, and it is known that people do not like websites to pay attention to their visits and find out about their previous surfing. Websites’ use of these files is a violation of users’ privacy, and it is not permissible to access those files except with the user’s permission.

Based on that, pages and websites that want to use these files must inform visitors of that, alerting users to the matter in a clear way that the users can easily see, so that they will be aware of where they stand.


There is nothing wrong with putting ads on your private website, on condition that they are free of haraam things and do not promote haraam things.

That is on condition that you let visitors know that the website will show ads appropriate to each visitor, based on cookies placed on his computer.

And Allah knows best.

Was this answer helpful?

Source: Islam Q&A