How to run code when cookie is added?

How to run code when cookie is added?