I've noticed anytime i go to a website and leave and go to youtube i see their ad. How does that work?

I guess the website tracks me, and sends me pop up ad's at the bottom of youtube. I get specific ad's from the website i just viewed. I am curious how this transaction works. Does youtube and these companies have an understanding together. And how does youtube get compensated for this? I mean millions of... show more I guess the website tracks me, and sends me pop up ad's at the bottom of youtube. I get specific ad's from the website i just viewed. I am curious how this transaction works. Does youtube and these companies have an understanding together. And how does youtube get compensated for this? I mean millions of different designated ad's on their videos how do they keep track. Does the company X pay a bill to youtube for anyone that views a video w/ an ad that just looked at company X's website? All a bit confusing to me.
Please explain if you know.
Thanks!
1 answer 1