I thought this page from Media Shark offered a nice summary of the two types of behavioral targeting of ads. Behavioral targeting means that your online behaviors – what you view, how long you view, what you like, etc. – can be collected to gain insights into your interests and offer you information it appears might interest or influence you.
There are two types of behavioral targeting – contextual and cross-platform. With contextual targeting, a site collects information on your behaviors while on that site and in some way responds based on an interpretation of this behavior. For example, if you are searching for a given product while on Amazon, Amazon assumes you have an interest in a specific type of product and can offer you additional options. This seems pretty rational and easy to understand. Note however, that similar behaviors might be used by Facebook as you spend time on this platform to categorize you and target ads or prioritize your news feed based on this accumulated information about your activities.
Cross-platform targeting means your behavior across the internet can be aggregated and used to classify you in different ways. An ad service can collect and use this information (placing users in different categories) to offer internet services a way to provide targeted ads to individuals from these specific categories. For example, the Google ads you may see on this blog work in this fashion.
Information about your online behavior is often collected in files stored on the devices of Internet users as cookies. You may have heard of first-party and third-party cookies. First-party cookies store information related to a given site and use this information when a user accesses this site. Third-party cookies can collect information across sites and this information can be used by sites not collecting much of this information. Some services allow the blocking of third-party cookies while allowing first-party cookies. There is some rationale for this approach. It may make some sense that you allow first-party cookies as a way to compensate a site for using its services, but object to third-party cookies that collect information about you from sites you are not compensating with data based on your attention and activities.