SAN FRANCISCO (Reuters) - Facebook Inc said on Thursday it had agreed to buy advertising technology from Microsoft Corp that measures the effectiveness of ads on its website, which should help in its fight with Google Inc for online advertising revenue.