Microsoft agreed to buy digital marketing firm aQuantive in a deal valued at $6 billion.