browser – How do ads on different websites know what I’ve been searching on shopping websites?

Recently I’m searching for a Nikon camera on and A day later, I’m seeing lots of ads on different websites which are not even related to cameras or shopping. For example, I was search Windows 11 beta release date articles. I visited a few websites and Lo! I saw Nikon ads. I found camera ads on too.

A few similar questions have already been asked, like this one, but it doesn’t answer my doubts.

I read many articles too online, all I could understand is that it is related to cookies. But they didn’t give simple examples so I can understand how it works.

From what I know, if I set a cookie using my website in a browser, it can only be accessed on same domain. So if I have another website, I can’t even find that cookie. I’ve personally tested it. So it confuses me even more.

One or two articles I found that tried to explain this were too advanced for me to understand. They went too deep into IP settings and blah blah blah. I know in reality things are actually complex, but I’m sure it still can be explained simply.

So I need a simple example that can help me understand how it works.

Something like, if I search for a product on, how would ads on be related to that product I was searching for.