What is the etymology of the word cookie?

The earliest known usage of the work cookie comes from 1701 in Scotland, where it meant "plain bun".  Starting in 1808 the term was associated with small, flat, sweet cakes as part of American English, which is believed to be derived from the Dutch word keokie.