Add Universal Analytics & Refactor

Added support for universal analytics and refactored code.