Added logic for Analytics