better event handling for google analytics