I'm in the process of developing an automated marketing system and need assistance in developing a cookie script which can gather users search history and send it back to my sql together with the users email address, which I will already have.

The cookie will sit on various websites and users will be notified of it and it's use for marketing.

I would like an example script for this or alternatively any other method of doing this would be appreciated too.

Look forward to hearing back.