Websites collect visitor data including pages visited, amount of time on a page, links that are clicked on, and searches that are performed. All of this data creates a “profile” of the visitor that links to their web browser. Based on this data, visitors are put into an audience segment. When web users from a particular audience segment return to that website or another website that is part of the same network and are using the same browser, the audience segment information is used for advertisers to show an online ad that is relevant to that user. It is assumed that based on previous behavior, that there is a greater level of interest and intent for a particular product or service that is being offered and that the ad is more likely to be clicked on. Because these ads are targeted based on previous behavior, publishers can sell these ads for a higher price.
Here’s how behavioral targeting works: Targeting companies establish an agreement with a publisher, who puts a piece of code on his website. (That publisher must have a clearly stated policy for the consumer to opt out from having data collected.) Then, when you're browsing the web, the site will put a cookie on your browser, which populates as you surf.
Now that your browser has a cookie, the targeting begins. Data points amass as you click your way from site to site, taking note of what you buy, what you read and what you search for. The more time goes on, the more data is collected.
This data can be saved and stored automatically simply be having it stored in a MySQL Database that can be accessed by a control panel for reference.