Adding event tracking code