def _trace_ga(action_name,  auth_user, client_user, client_token, label):
    from google_measurement_protocol import Event, report
    try:
        username = auth_user or client_user or client_token
        logger.debug("Auth user / client_user: %s/%s/%s" % (auth_user, client_user, client_token))
        logger.debug("Enter analytics with params: %s, %s, %s" % (action_name, username, label))
        aes_manager = AESEncryption(BII_AES_SECRET_KEY)
        client_id = aes_manager.encrypt(username)
        logger.debug("Client id encoded: %s" % str(client_id))
        event = Event('bii_api_call', action_name, label)

        ret = report(BII_GA_API_KEY, client_id, event)
        if ret[0].status_code == 200:
            logger.debug("ANALYTICS: Logged: %s to google analytics"
                         " for visitor %s - %s" % (action_name, username, client_id))
        else:
            logger.debug("Error logging to analytics: %s " % (ret[0].reason))
    except Exception as exc:
        logger.warning("Error sending to action to ga: %s" % (exc))
dataset/ETHPy150Open biicode/bii-server/rest/bottle_plugins/bii_user_trace_bottle_plugin.py/_trace_ga/original